Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
CAP
Commits
00f42253
Commit
00f42253
authored
Jun 23, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comments.
parent
f8d3f4b2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
84 additions
and
2 deletions
+84
-2
ConsumerContext.cs
src/DotNetCore.CAP/Abstractions/ConsumerContext.cs
+14
-0
ConsumerExecutorDescriptor.cs
...DotNetCore.CAP/Abstractions/ConsumerExecutorDescriptor.cs
+3
-0
ConsumerInvokerContext.cs
src/DotNetCore.CAP/Abstractions/ConsumerInvokerContext.cs
+3
-0
IConsumerInvoker.cs
src/DotNetCore.CAP/Abstractions/IConsumerInvoker.cs
+6
-0
IModelBinder.cs
src/DotNetCore.CAP/Abstractions/ModelBinding/IModelBinder.cs
+20
-0
ModelBindingContext.cs
...Core.CAP/Abstractions/ModelBinding/ModelBindingContext.cs
+27
-0
TopicAttribute.cs
src/DotNetCore.CAP/Abstractions/TopicAttribute.cs
+9
-0
CAP.Builder.cs
src/DotNetCore.CAP/CAP.Builder.cs
+1
-1
DotNetCore.CAP.csproj
src/DotNetCore.CAP/DotNetCore.CAP.csproj
+1
-1
No files found.
src/DotNetCore.CAP/Abstractions/ConsumerContext.cs
View file @
00f42253
...
...
@@ -3,16 +3,30 @@ using DotNetCore.CAP.Infrastructure;
namespace
DotNetCore.CAP.Abstractions
{
/// <summary>
/// A context for consumers, it used to be provider wapper of method description and received message.
/// </summary>
public
class
ConsumerContext
{
/// <summary>
/// create a new instance of <see cref="ConsumerContext"/> .
/// </summary>
/// <param name="descriptor">consumer method descriptor. </param>
/// <param name="message"> reveied message.</param>
public
ConsumerContext
(
ConsumerExecutorDescriptor
descriptor
,
DeliverMessage
message
)
{
ConsumerDescriptor
=
descriptor
??
throw
new
ArgumentNullException
(
nameof
(
descriptor
));
DeliverMessage
=
message
??
throw
new
ArgumentNullException
(
nameof
(
message
));
}
/// <summary>
/// a descriptor of consumer information need to be performed.
/// </summary>
public
ConsumerExecutorDescriptor
ConsumerDescriptor
{
get
;
set
;
}
/// <summary>
/// consumer reveived message.
/// </summary>
public
DeliverMessage
DeliverMessage
{
get
;
set
;
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Abstractions/ConsumerExecutorDescriptor.cs
View file @
00f42253
...
...
@@ -2,6 +2,9 @@
namespace
DotNetCore.CAP.Abstractions
{
/// <summary>
/// A descriptor of user definition method.
/// </summary>
public
class
ConsumerExecutorDescriptor
{
public
MethodInfo
MethodInfo
{
get
;
set
;
}
...
...
src/DotNetCore.CAP/Abstractions/ConsumerInvokerContext.cs
View file @
00f42253
...
...
@@ -2,6 +2,9 @@
namespace
DotNetCore.CAP.Abstractions
{
/// <summary>
/// a context of consumer invoker.
/// </summary>
public
class
ConsumerInvokerContext
{
public
ConsumerInvokerContext
(
ConsumerContext
consumerContext
)
...
...
src/DotNetCore.CAP/Abstractions/IConsumerInvoker.cs
View file @
00f42253
...
...
@@ -2,8 +2,14 @@
namespace
DotNetCore.CAP.Abstractions
{
/// <summary>
/// Perform user definition method of consumers.
/// </summary>
public
interface
IConsumerInvoker
{
/// <summary>
/// begin to invoke method.
/// </summary>
Task
InvokeAsync
();
}
}
\ No newline at end of file
src/DotNetCore.CAP/Abstractions/ModelBinding/IModelBinder.cs
View file @
00f42253
...
...
@@ -2,8 +2,28 @@
namespace
DotNetCore.CAP.Abstractions.ModelBinding
{
/// <summary>
/// Defines an interface for model binders.
/// </summary>
public
interface
IModelBinder
{
/// <summary>
/// Attempts to bind a model.
/// </summary>
/// <param name="bindingContext">The <see cref="ModelBindingContext"/>.</param>
/// <returns>
/// <para>
/// A <see cref="Task"/> which will complete when the model binding process completes.
/// </para>
/// <para>
/// If model binding was successful, the <see cref="ModelBindingContext.Result"/> should have
/// <see cref="ModelBindingResult.IsModelSet"/> set to <c>true</c>.
/// </para>
/// <para>
/// A model binder that completes successfully should set <see cref="ModelBindingContext.Result"/> to
/// a value returned from <see cref="ModelBindingResult.Success"/>.
/// </para>
/// </returns>
Task
BindModelAsync
(
ModelBindingContext
bindingContext
);
}
}
\ No newline at end of file
src/DotNetCore.CAP/Abstractions/ModelBinding/ModelBindingContext.cs
View file @
00f42253
...
...
@@ -3,18 +3,45 @@ using Microsoft.Extensions.Primitives;
namespace
DotNetCore.CAP.Abstractions.ModelBinding
{
// <summary>
/// A context that contains operating information for model binding and validation.
/// </summary>
public
class
ModelBindingContext
{
/// <summary>
/// Gets or sets the model value for the current operation.
/// </summary>
/// <remarks>
/// The <see cref="Model"/> will typically be set for a binding operation that works
/// against a pre-existing model object to update certain properties.
/// </remarks>
public
object
Model
{
get
;
set
;
}
/// <summary>
/// Gets or sets the name of the model.
/// </summary>
public
string
ModelName
{
get
;
set
;
}
/// <summary>
/// Gets or sets the type of the model.
/// </summary>
public
Type
ModelType
{
get
;
set
;
}
/// <summary>
/// Gets or sets the values of the model.
/// </summary>
public
StringValues
Values
{
get
;
set
;
}
/// <summary>
/// <para>
/// Gets or sets a result which represents the result of the model binding process.
/// </para>
/// </summary>
public
object
Result
{
get
;
set
;
}
/// <summary>
/// Creates a new <see cref="ModelBindingContext"/> for top-level model binding operation.
/// </summary>
public
static
ModelBindingContext
CreateBindingContext
(
string
values
,
string
modelName
,
Type
modelType
)
{
return
new
ModelBindingContext
()
...
...
src/DotNetCore.CAP/Abstractions/TopicAttribute.cs
View file @
00f42253
...
...
@@ -2,6 +2,9 @@
namespace
DotNetCore.CAP.Abstractions
{
/// <summary>
/// An abstract attribute that for kafka attribute or rabbitmq attribute
/// </summary>
[
AttributeUsage
(
AttributeTargets
.
Method
|
AttributeTargets
.
Class
,
Inherited
=
true
,
AllowMultiple
=
true
)]
public
abstract
class
TopicAttribute
:
Attribute
{
...
...
@@ -12,11 +15,17 @@ namespace DotNetCore.CAP.Abstractions
this
.
_name
=
topicName
;
}
/// <summary>
/// topic or exchange route key name.
/// </summary>
public
string
Name
{
get
{
return
_name
;
}
}
/// <summary>
/// the consumer group.
/// </summary>
public
string
GroupOrExchange
{
get
;
set
;
}
public
bool
IsOneWay
{
get
;
set
;
}
...
...
src/DotNetCore.CAP/CAP.Builder.cs
View file @
00f42253
...
...
@@ -49,7 +49,7 @@ namespace Microsoft.Extensions.DependencyInjection
return
AddSingleton
<
IJob
,
T
>();
}
public
virtual
CapBuilder
AddProducer
Client
<
T
>()
public
virtual
CapBuilder
AddProducer
Service
<
T
>()
where
T
:
class
,
ICapProducerService
{
return
AddScoped
(
typeof
(
ICapProducerService
),
typeof
(
T
));
...
...
src/DotNetCore.CAP/DotNetCore.CAP.csproj
View file @
00f42253
...
...
@@ -19,7 +19,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.1" />
<PackageReference Include="ncrontab" Version="3.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.
2
" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.
3
" />
<PackageReference Include="System.Threading.ThreadPool" Version="4.3.0" />
</ItemGroup>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment