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
59025d21
Commit
59025d21
authored
Oct 25, 2017
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add summary comments.
parent
04ef816e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
6 deletions
+60
-6
IContentSerializer.cs
src/DotNetCore.CAP/Abstractions/IContentSerializer.cs
+43
-4
IModelBinderFactory.cs
src/DotNetCore.CAP/Abstractions/IModelBinderFactory.cs
+8
-0
ISubscriberExecutor.cs
src/DotNetCore.CAP/Abstractions/ISubscriberExecutor.cs
+7
-0
TopicAttribute.cs
src/DotNetCore.CAP/Abstractions/TopicAttribute.cs
+2
-2
No files found.
src/DotNetCore.CAP/Abstractions/IContentSerializer.cs
View file @
59025d21
...
@@ -3,19 +3,58 @@ using DotNetCore.CAP.Models;
...
@@ -3,19 +3,58 @@ using DotNetCore.CAP.Models;
namespace
DotNetCore.CAP.Abstractions
namespace
DotNetCore.CAP.Abstractions
{
{
/// <summary>
/// Message content serializer.
/// <para>By default, CAP will use Json as a serializer, and you can customize this interface to achieve serialization of other methods.</para>
/// </summary>
public
interface
IContentSerializer
public
interface
IContentSerializer
{
{
string
Serialize
<
T
>(
T
obj
);
/// <summary>
/// Serializes the specified object to a string.
/// </summary>
/// <typeparam name="T"> The type of the value being serialized.</typeparam>
/// <param name="value">The object to serialize.</param>
/// <returns>A string representation of the object.</returns>
string
Serialize
<
T
>(
T
value
);
T
DeSerialize
<
T
>(
string
content
);
/// <summary>
/// Deserializes the string to the specified .NET type.
/// </summary>
/// <typeparam name="T">The type of the object to deserialize to.</typeparam>
/// <param name="value">The content string to deserialize.</param>
/// <returns>The deserialized object from the string.</returns>
T
DeSerialize
<
T
>(
string
value
);
object
DeSerialize
(
string
content
,
Type
type
);
/// <summary>
/// Deserializes the string to the specified .NET type.
/// </summary>
/// <param name="value">The string to deserialize.</param>
/// <param name="type">The type of the object to deserialize to.</param>
/// <returns>The deserialized object from the string.</returns>
object
DeSerialize
(
string
value
,
Type
type
);
}
}
/// <summary>
/// CAP message content wapper.
/// <para>You can customize the message body filed name of the wrapper or add fields that you interested.</para>
/// </summary>
/// <remarks>
/// We use the wrapper to provide some additional information for the message content,which is important for CAP。
/// Typically, we may need to customize the field display name of the message,
/// which includes interacting with other message components, which can be adapted in this manner
/// </remarks>
public
interface
IMessagePacker
public
interface
IMessagePacker
{
{
/// <summary>
/// Package a message object
/// </summary>
/// <param name="obj">The obj message to be packed.</param>
string
Pack
(
CapMessage
obj
);
string
Pack
(
CapMessage
obj
);
/// <summary>
/// Unpack a message strings to <see cref="CapMessage"/> object.
/// </summary>
/// <param name="packingMessage">The string of packed message.</param>
CapMessage
UnPack
(
string
packingMessage
);
CapMessage
UnPack
(
string
packingMessage
);
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Abstractions/IModelBinderFactory.cs
View file @
59025d21
...
@@ -3,8 +3,16 @@ using DotNetCore.CAP.Abstractions.ModelBinding;
...
@@ -3,8 +3,16 @@ using DotNetCore.CAP.Abstractions.ModelBinding;
namespace
DotNetCore.CAP.Abstractions
namespace
DotNetCore.CAP.Abstractions
{
{
/// <summary>
/// Model binder factory.
/// </summary>
public
interface
IModelBinderFactory
public
interface
IModelBinderFactory
{
{
/// <summary>
/// Create a model binder by parameter.
/// </summary>
/// <param name="parameter">The method parameter info</param>
/// <returns>A model binder instance.</returns>
IModelBinder
CreateBinder
(
ParameterInfo
parameter
);
IModelBinder
CreateBinder
(
ParameterInfo
parameter
);
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/Abstractions/ISubscriberExecutor.cs
View file @
59025d21
...
@@ -3,8 +3,15 @@ using DotNetCore.CAP.Models;
...
@@ -3,8 +3,15 @@ using DotNetCore.CAP.Models;
namespace
DotNetCore.CAP.Abstractions
namespace
DotNetCore.CAP.Abstractions
{
{
/// <summary>
/// Consumer method executor.
/// </summary>
public
interface
ISubscriberExecutor
public
interface
ISubscriberExecutor
{
{
/// <summary>
/// Execute the consumer method.
/// </summary>
/// <param name="receivedMessage">The received message.</param>
Task
<
OperateResult
>
ExecuteAsync
(
CapReceivedMessage
receivedMessage
);
Task
<
OperateResult
>
ExecuteAsync
(
CapReceivedMessage
receivedMessage
);
}
}
}
}
src/DotNetCore.CAP/Abstractions/TopicAttribute.cs
View file @
59025d21
...
@@ -4,7 +4,7 @@ namespace DotNetCore.CAP.Abstractions
...
@@ -4,7 +4,7 @@ namespace DotNetCore.CAP.Abstractions
{
{
/// <inheritdoc />
/// <inheritdoc />
/// <summary>
/// <summary>
/// An abstract attribute that for
kafka attribute or rabbit mq attribute
/// An abstract attribute that for kafka attribute or rabbit mq attribute
/// </summary>
/// </summary>
[
AttributeUsage
(
AttributeTargets
.
Method
|
AttributeTargets
.
Class
,
AllowMultiple
=
true
)]
[
AttributeUsage
(
AttributeTargets
.
Method
|
AttributeTargets
.
Class
,
AllowMultiple
=
true
)]
public
abstract
class
TopicAttribute
:
Attribute
public
abstract
class
TopicAttribute
:
Attribute
...
@@ -15,7 +15,7 @@ namespace DotNetCore.CAP.Abstractions
...
@@ -15,7 +15,7 @@ namespace DotNetCore.CAP.Abstractions
}
}
/// <summary>
/// <summary>
///
t
opic or exchange route key name.
///
T
opic or exchange route key name.
/// </summary>
/// </summary>
public
string
Name
{
get
;
}
public
string
Name
{
get
;
}
...
...
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