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
f0040458
Commit
f0040458
authored
Jul 09, 2017
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename CapProductorService to CapPublisher.
parent
ddc99e4e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
23 deletions
+23
-23
ValuesController.cs
samples/Sample.Kafka/Controllers/ValuesController.cs
+3
-3
CAP.Builder.cs
src/DotNetCore.CAP/CAP.Builder.cs
+3
-3
CAP.ServiceCollectionExtensions.cs
src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs
+1
-1
ICapPublisher.Default.cs
src/DotNetCore.CAP/ICapPublisher.Default.cs
+6
-6
ICapPublisher.cs
src/DotNetCore.CAP/ICapPublisher.cs
+6
-6
CAP.BuilderTest.cs
test/DotNetCore.CAP.Test/CAP.BuilderTest.cs
+4
-4
No files found.
samples/Sample.Kafka/Controllers/ValuesController.cs
View file @
f0040458
...
...
@@ -10,9 +10,9 @@ namespace Sample.Kafka.Controllers
[
Route
(
"api/[controller]"
)]
public
class
ValuesController
:
Controller
,
ICapSubscribe
{
private
readonly
ICapP
roducerService
_producer
;
private
readonly
ICapP
ublisher
_producer
;
public
ValuesController
(
ICapP
roducerService
producer
)
public
ValuesController
(
ICapP
ublisher
producer
)
{
_producer
=
producer
;
}
...
...
@@ -35,7 +35,7 @@ namespace Sample.Kafka.Controllers
[
Route
(
"~/send"
)]
public
async
Task
<
IActionResult
>
SendTopic
()
{
await
_producer
.
Send
Async
(
"zzwl.topic.finace.callBack"
,
new
Person
{
Name
=
"Test"
,
Age
=
11
});
await
_producer
.
Publish
Async
(
"zzwl.topic.finace.callBack"
,
new
Person
{
Name
=
"Test"
,
Age
=
11
});
return
Ok
();
}
...
...
src/DotNetCore.CAP/CAP.Builder.cs
View file @
f0040458
...
...
@@ -68,13 +68,13 @@ namespace DotNetCore.CAP
}
/// <summary>
/// Add an <see cref="ICapP
roducerService
"/>.
/// Add an <see cref="ICapP
ublisher
"/>.
/// </summary>
/// <typeparam name="T">The type of the service.</typeparam>
public
virtual
CapBuilder
AddProducerService
<
T
>()
where
T
:
class
,
ICapP
roducerService
where
T
:
class
,
ICapP
ublisher
{
return
AddScoped
(
typeof
(
ICapP
roducerService
),
typeof
(
T
));
return
AddScoped
(
typeof
(
ICapP
ublisher
),
typeof
(
T
));
}
}
}
\ No newline at end of file
src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs
View file @
f0040458
...
...
@@ -56,7 +56,7 @@ namespace Microsoft.Extensions.DependencyInjection
services
.
TryAddSingleton
<
IJob
,
CapJob
>();
services
.
TryAddTransient
<
DefaultCronJobRegistry
>();
services
.
TryAddScoped
<
ICapP
roducerService
,
DefaultProducerService
>();
services
.
TryAddScoped
<
ICapP
ublisher
,
DefaultCapPublisher
>();
return
new
CapBuilder
(
services
);
}
...
...
src/DotNetCore.CAP/ICapP
roducerService
.Default.cs
→
src/DotNetCore.CAP/ICapP
ublisher
.Default.cs
View file @
f0040458
...
...
@@ -6,22 +6,22 @@ using Microsoft.Extensions.Logging;
namespace
DotNetCore.CAP
{
/// <summary>
/// Cap <see cref="ICapP
roducerService
"/> default implement.
/// Cap <see cref="ICapP
ublisher
"/> default implement.
/// </summary>
public
class
Default
ProducerService
:
ICapProducerService
public
class
Default
CapPublisher
:
ICapPublisher
{
private
readonly
ICapMessageStore
_store
;
private
readonly
ILogger
_logger
;
public
Default
ProducerService
(
public
Default
CapPublisher
(
ICapMessageStore
store
,
ILogger
<
Default
ProducerService
>
logger
)
ILogger
<
Default
CapPublisher
>
logger
)
{
_store
=
store
;
_logger
=
logger
;
}
public
Task
Send
Async
(
string
topic
,
string
content
)
public
Task
Publish
Async
(
string
topic
,
string
content
)
{
if
(
topic
==
null
)
throw
new
ArgumentNullException
(
nameof
(
topic
));
if
(
content
==
null
)
throw
new
ArgumentNullException
(
nameof
(
content
));
...
...
@@ -29,7 +29,7 @@ namespace DotNetCore.CAP
return
StoreMessage
(
topic
,
content
);
}
public
Task
Send
Async
<
T
>(
string
topic
,
T
contentObj
)
public
Task
Publish
Async
<
T
>(
string
topic
,
T
contentObj
)
{
if
(
topic
==
null
)
throw
new
ArgumentNullException
(
nameof
(
topic
));
...
...
src/DotNetCore.CAP/ICapP
roducerService
.cs
→
src/DotNetCore.CAP/ICapP
ublisher
.cs
View file @
f0040458
...
...
@@ -3,24 +3,24 @@
namespace
DotNetCore.CAP
{
/// <summary>
///
Cap producer service for store message to database
.
///
A publish service for publish a message to CAP
.
/// </summary>
public
interface
ICapP
roducerService
public
interface
ICapP
ublisher
{
/// <summary>
///
Send a message to cap job
.
///
Publish a string message to specified topic
.
/// </summary>
/// <param name="topic">the topic name or exchange router key.</param>
/// <param name="content">message body content.</param>
Task
Send
Async
(
string
topic
,
string
content
);
Task
Publish
Async
(
string
topic
,
string
content
);
/// <summary>
///
Send a message to cap job
.
///
Publis a object message to specified topic
.
/// </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
Send
Async
<
T
>(
string
topic
,
T
contentObj
);
Task
Publish
Async
<
T
>(
string
topic
,
T
contentObj
);
}
}
\ No newline at end of file
test/DotNetCore.CAP.Test/CAP.BuilderTest.cs
View file @
f0040458
...
...
@@ -41,20 +41,20 @@ namespace DotNetCore.CAP.Test
services
.
AddCap
().
AddProducerService
<
MyProducerService
>();
var
thingy
=
services
.
BuildServiceProvider
()
.
GetRequiredService
<
ICapP
roducerService
>()
as
MyProducerService
;
.
GetRequiredService
<
ICapP
ublisher
>()
as
MyProducerService
;
Assert
.
NotNull
(
thingy
);
}
private
class
MyProducerService
:
ICapP
roducerService
private
class
MyProducerService
:
ICapP
ublisher
{
public
Task
Send
Async
(
string
topic
,
string
content
)
public
Task
Publish
Async
(
string
topic
,
string
content
)
{
throw
new
NotImplementedException
();
}
public
Task
Send
Async
<
T
>(
string
topic
,
T
contentObj
)
public
Task
Publish
Async
<
T
>(
string
topic
,
T
contentObj
)
{
throw
new
NotImplementedException
();
}
...
...
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