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
1d3692d4
Commit
1d3692d4
authored
Jun 24, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add summary comment.
parent
34f77642
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
51 additions
and
4 deletions
+51
-4
RabbitMQProducerClient.cs
src/DotNetCore.CAP.RabbitMQ/RabbitMQProducerClient.cs
+6
-1
IBootstrapper.Default.cs
src/DotNetCore.CAP/IBootstrapper.Default.cs
+4
-0
ICapProducerService.Default.cs
src/DotNetCore.CAP/ICapProducerService.Default.cs
+6
-3
ICapProducerService.cs
src/DotNetCore.CAP/ICapProducerService.cs
+17
-0
IConsumerClient.cs
src/DotNetCore.CAP/IConsumerClient.cs
+3
-0
IConsumerClientFactory.cs
src/DotNetCore.CAP/IConsumerClientFactory.cs
+9
-0
IConsumerService.cs
src/DotNetCore.CAP/IConsumerService.cs
+3
-0
IProcessingServer.cs
src/DotNetCore.CAP/IProcessingServer.cs
+3
-0
No files found.
src/DotNetCore.CAP.RabbitMQ/RabbitMQProducerClient.cs
View file @
1d3692d4
using
System.Text
;
using
System
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
DotNetCore.CAP.Infrastructure
;
using
DotNetCore.CAP.Infrastructure
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
...
@@ -36,5 +37,9 @@ namespace DotNetCore.CAP.RabbitMQ
...
@@ -36,5 +37,9 @@ namespace DotNetCore.CAP.RabbitMQ
return
Task
.
CompletedTask
;
return
Task
.
CompletedTask
;
}
}
}
}
public
Task
SendAsync
<
T
>(
string
topic
,
T
contentObj
)
{
throw
new
NotImplementedException
();
}
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/IBootstrapper.Default.cs
View file @
1d3692d4
...
@@ -9,6 +9,9 @@ using Microsoft.Extensions.Options;
...
@@ -9,6 +9,9 @@ using Microsoft.Extensions.Options;
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
/// <summary>
/// Default implement of <see cref="IBootstrapper"/>.
/// </summary>
public
class
DefaultBootstrapper
:
IBootstrapper
public
class
DefaultBootstrapper
:
IBootstrapper
{
{
private
IApplicationLifetime
_appLifetime
;
private
IApplicationLifetime
_appLifetime
;
...
@@ -27,6 +30,7 @@ namespace DotNetCore.CAP
...
@@ -27,6 +30,7 @@ namespace DotNetCore.CAP
_appLifetime
=
appLifetime
;
_appLifetime
=
appLifetime
;
Provider
=
provider
;
Provider
=
provider
;
Servers
=
Provider
.
GetServices
<
IProcessingServer
>();
Servers
=
Provider
.
GetServices
<
IProcessingServer
>();
_cts
=
new
CancellationTokenSource
();
_cts
=
new
CancellationTokenSource
();
_ctsRegistration
=
appLifetime
.
ApplicationStopping
.
Register
(()
=>
_ctsRegistration
=
appLifetime
.
ApplicationStopping
.
Register
(()
=>
{
{
...
...
src/DotNetCore.CAP/ICapProducerService.Default.cs
View file @
1d3692d4
...
@@ -6,6 +6,9 @@ using Microsoft.Extensions.Logging;
...
@@ -6,6 +6,9 @@ using Microsoft.Extensions.Logging;
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
/// <summary>
/// Cap <see cref="ICapProducerService"/> default implement.
/// </summary>
public
class
DefaultProducerService
:
ICapProducerService
public
class
DefaultProducerService
:
ICapProducerService
{
{
private
readonly
ICapMessageStore
_store
;
private
readonly
ICapMessageStore
_store
;
...
@@ -29,13 +32,13 @@ namespace DotNetCore.CAP
...
@@ -29,13 +32,13 @@ namespace DotNetCore.CAP
return
StoreMessage
(
topic
,
content
);
return
StoreMessage
(
topic
,
content
);
}
}
public
Task
SendAsync
<
T
>(
string
topic
,
T
o
bj
)
public
Task
SendAsync
<
T
>(
string
topic
,
T
contentO
bj
)
{
{
if
(
topic
==
null
)
throw
new
ArgumentNullException
(
nameof
(
topic
));
if
(
topic
==
null
)
throw
new
ArgumentNullException
(
nameof
(
topic
));
var
content
=
Helper
.
ToJson
(
o
bj
);
var
content
=
Helper
.
ToJson
(
contentO
bj
);
if
(
content
==
null
)
if
(
content
==
null
)
throw
new
InvalidCastException
(
nameof
(
o
bj
));
throw
new
InvalidCastException
(
nameof
(
contentO
bj
));
return
StoreMessage
(
topic
,
content
);
return
StoreMessage
(
topic
,
content
);
}
}
...
...
src/DotNetCore.CAP/ICapProducerService.cs
View file @
1d3692d4
...
@@ -2,8 +2,25 @@
...
@@ -2,8 +2,25 @@
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
/// <summary>
/// Cap producer service for store message to database.
/// </summary>
public
interface
ICapProducerService
public
interface
ICapProducerService
{
{
/// <summary>
/// Send a message to cap job.
/// </summary>
/// <param name="topic">the topic name or exchange router key.</param>
/// <param name="content">message body content.</param>
Task
SendAsync
(
string
topic
,
string
content
);
Task
SendAsync
(
string
topic
,
string
content
);
/// <summary>
/// Send a message to cap job.
/// </summary>
/// <typeparam name="T">The type of conetent object.</typeparam>
/// <param name="topic">the topic name or exchange router key.</param>
/// <param name="contentObj">object instance that will be serialized of json.</param>
/// <returns></returns>
Task
SendAsync
<
T
>(
string
topic
,
T
contentObj
);
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/IConsumerClient.cs
View file @
1d3692d4
...
@@ -5,6 +5,9 @@ using DotNetCore.CAP.Infrastructure;
...
@@ -5,6 +5,9 @@ using DotNetCore.CAP.Infrastructure;
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
/// <summary>
/// consumer client
/// </summary>
public
interface
IConsumerClient
:
IDisposable
public
interface
IConsumerClient
:
IDisposable
{
{
void
Subscribe
(
string
topic
);
void
Subscribe
(
string
topic
);
...
...
src/DotNetCore.CAP/IConsumerClientFactory.cs
View file @
1d3692d4
...
@@ -5,8 +5,17 @@ using System.Threading.Tasks;
...
@@ -5,8 +5,17 @@ using System.Threading.Tasks;
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
/// <summary>
/// Consumer client factory to create consumer client instance.
/// </summary>
public
interface
IConsumerClientFactory
public
interface
IConsumerClientFactory
{
{
/// <summary>
/// Create a new instance of <see cref="IConsumerClient"/>.
/// </summary>
/// <param name="groupId"></param>
/// <param name="clientHostAddress"></param>
/// <returns></returns>
IConsumerClient
Create
(
string
groupId
,
string
clientHostAddress
);
IConsumerClient
Create
(
string
groupId
,
string
clientHostAddress
);
}
}
}
}
src/DotNetCore.CAP/IConsumerService.cs
View file @
1d3692d4
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
/// <summary>
/// An empty interface, which is used to mark the current class have a CAP methods.
/// </summary>
public
interface
IConsumerService
public
interface
IConsumerService
{
{
}
}
...
...
src/DotNetCore.CAP/IProcessingServer.cs
View file @
1d3692d4
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
/// <summary>
/// A process thread abstract of job process.
/// </summary>
public
interface
IProcessingServer
:
IDisposable
public
interface
IProcessingServer
:
IDisposable
{
{
void
Start
();
void
Start
();
...
...
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