Skip to content

Commit 607a990

Browse files
committed
Merge branch 'master' into supports/nats
# Conflicts: # CAP.sln # CAP.sln.DotSettings # src/DotNetCore.CAP/Internal/IConsumerRegister.Default.cs # src/DotNetCore.CAP/Transport/MqLogType.cs
2 parents 3868047 + 81b8f2c commit 607a990

File tree

157 files changed

+2072
-674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+2072
-674
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: csharp
22
sudo: required
33
dist: xenial
44
solution: CAP.sln
5-
dotnet: 3.1.100
5+
dotnet: 5.0.100
66
mono: none
77
env:
88
- Cap_MySql_ConnectionString="Server=127.0.0.1;Database=cap_test;Uid=root;Pwd=;Allow User Variables=True;SslMode=none"

CAP.sln

+13-13
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.AzureService
5151
EndProject
5252
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.Dashboard", "src\DotNetCore.CAP.Dashboard\DotNetCore.CAP.Dashboard.csproj", "{56FB261C-67AF-4715-9A46-4FA4FAB91B2C}"
5353
EndProject
54-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Kafka.InMemory", "samples\Sample.Kafka.InMemory\Sample.Kafka.InMemory.csproj", "{1B0371D6-36A4-4C78-A727-8ED732FDBA1D}"
55-
EndProject
5654
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.RabbitMQ.SqlServer", "samples\Sample.RabbitMQ.SqlServer\Sample.RabbitMQ.SqlServer.csproj", "{F6C5C676-AF05-46D5-A45D-442137B31898}"
5755
EndProject
5856
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Kafka.PostgreSql", "samples\Sample.Kafka.PostgreSql\Sample.Kafka.PostgreSql.csproj", "{F1EF1D26-8A6B-403E-85B0-250DF44A4A7C}"
@@ -65,7 +63,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.Test", "test
6563
EndProject
6664
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.ConsoleApp", "samples\Sample.ConsoleApp\Sample.ConsoleApp.csproj", "{2B0F467E-ABBD-4A51-BF38-D4F609DB6266}"
6765
EndProject
68-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.NATS", "src\DotNetCore.CAP.NATS\DotNetCore.CAP.NATS.csproj", "{25A1B3A1-DD74-436C-9956-17E04FE7643D}"
66+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCore.CAP.AmazonSQS", "src\DotNetCore.CAP.AmazonSQS\DotNetCore.CAP.AmazonSQS.csproj", "{43475E00-51B7-443D-BC2D-FC21F9D8A0B4}"
67+
EndProject
68+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.AmazonSQS.InMemory", "samples\Sample.AmazonSQS.InMemory\Sample.AmazonSQS.InMemory.csproj", "{B187DD15-092D-4B72-9807-50856607D237}"
6969
EndProject
7070
Global
7171
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -121,10 +121,6 @@ Global
121121
{56FB261C-67AF-4715-9A46-4FA4FAB91B2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
122122
{56FB261C-67AF-4715-9A46-4FA4FAB91B2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
123123
{56FB261C-67AF-4715-9A46-4FA4FAB91B2C}.Release|Any CPU.Build.0 = Release|Any CPU
124-
{1B0371D6-36A4-4C78-A727-8ED732FDBA1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
125-
{1B0371D6-36A4-4C78-A727-8ED732FDBA1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
126-
{1B0371D6-36A4-4C78-A727-8ED732FDBA1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
127-
{1B0371D6-36A4-4C78-A727-8ED732FDBA1D}.Release|Any CPU.Build.0 = Release|Any CPU
128124
{F6C5C676-AF05-46D5-A45D-442137B31898}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
129125
{F6C5C676-AF05-46D5-A45D-442137B31898}.Debug|Any CPU.Build.0 = Debug|Any CPU
130126
{F6C5C676-AF05-46D5-A45D-442137B31898}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -149,10 +145,14 @@ Global
149145
{2B0F467E-ABBD-4A51-BF38-D4F609DB6266}.Debug|Any CPU.Build.0 = Debug|Any CPU
150146
{2B0F467E-ABBD-4A51-BF38-D4F609DB6266}.Release|Any CPU.ActiveCfg = Release|Any CPU
151147
{2B0F467E-ABBD-4A51-BF38-D4F609DB6266}.Release|Any CPU.Build.0 = Release|Any CPU
152-
{25A1B3A1-DD74-436C-9956-17E04FE7643D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
153-
{25A1B3A1-DD74-436C-9956-17E04FE7643D}.Debug|Any CPU.Build.0 = Debug|Any CPU
154-
{25A1B3A1-DD74-436C-9956-17E04FE7643D}.Release|Any CPU.ActiveCfg = Release|Any CPU
155-
{25A1B3A1-DD74-436C-9956-17E04FE7643D}.Release|Any CPU.Build.0 = Release|Any CPU
148+
{43475E00-51B7-443D-BC2D-FC21F9D8A0B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
149+
{43475E00-51B7-443D-BC2D-FC21F9D8A0B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
150+
{43475E00-51B7-443D-BC2D-FC21F9D8A0B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
151+
{43475E00-51B7-443D-BC2D-FC21F9D8A0B4}.Release|Any CPU.Build.0 = Release|Any CPU
152+
{B187DD15-092D-4B72-9807-50856607D237}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
153+
{B187DD15-092D-4B72-9807-50856607D237}.Debug|Any CPU.Build.0 = Debug|Any CPU
154+
{B187DD15-092D-4B72-9807-50856607D237}.Release|Any CPU.ActiveCfg = Release|Any CPU
155+
{B187DD15-092D-4B72-9807-50856607D237}.Release|Any CPU.Build.0 = Release|Any CPU
156156
EndGlobalSection
157157
GlobalSection(SolutionProperties) = preSolution
158158
HideSolutionNode = FALSE
@@ -170,14 +170,14 @@ Global
170170
{4473DE19-E8D2-4B57-80A8-C8AAA2BFA20F} = {3A6B6931-A123-477A-9469-8B468B5385AF}
171171
{63B2A464-FBEA-42FB-8EFA-98AFA39FC920} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4}
172172
{56FB261C-67AF-4715-9A46-4FA4FAB91B2C} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4}
173-
{1B0371D6-36A4-4C78-A727-8ED732FDBA1D} = {3A6B6931-A123-477A-9469-8B468B5385AF}
174173
{F6C5C676-AF05-46D5-A45D-442137B31898} = {3A6B6931-A123-477A-9469-8B468B5385AF}
175174
{F1EF1D26-8A6B-403E-85B0-250DF44A4A7C} = {3A6B6931-A123-477A-9469-8B468B5385AF}
176175
{F8EF381A-FE83-40B3-A63D-09D83851B0FB} = {10C0818D-9160-4B80-BB86-DDE925B64D43}
177176
{93176BAE-914B-4BED-9DE3-01FFB4F27FC5} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4}
178177
{75CC45E6-BF06-40F4-977D-10DCC05B2EFA} = {C09CDAB0-6DD4-46E9-B7F3-3EF2A4741EA0}
179178
{2B0F467E-ABBD-4A51-BF38-D4F609DB6266} = {3A6B6931-A123-477A-9469-8B468B5385AF}
180-
{25A1B3A1-DD74-436C-9956-17E04FE7643D} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4}
179+
{43475E00-51B7-443D-BC2D-FC21F9D8A0B4} = {9B2AE124-6636-4DE9-83A3-70360DABD0C4}
180+
{B187DD15-092D-4B72-9807-50856607D237} = {3A6B6931-A123-477A-9469-8B468B5385AF}
181181
EndGlobalSection
182182
GlobalSection(ExtensibilityGlobals) = postSolution
183183
SolutionGuid = {2E70565D-94CF-40B4-BFE1-AC18D5F736AB}

CAP.sln.DotSettings

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DB/@EntryIndexedValue">DB</s:String>
33
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NATS/@EntryIndexedValue">NATS</s:String>
4+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SNS/@EntryIndexedValue">SNS</s:String>
45
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mongo/@EntryIndexedValue">True</s:Boolean>
56
<s:Boolean x:Key="/Default/UserDictionary/Words/=NATS/@EntryIndexedValue">True</s:Boolean>
67
<s:Boolean x:Key="/Default/UserDictionary/Words/=Postgre/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

README.md

+35-18
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
<img height="140" src="https://cap.dotnetcore.xyz/img/logo.svg">
33
</p>
44

5-
# CAP                       [中文](https://github.com/dotnetcore/CAP/blob/master/README.zh-cn.md)
5+
# CAP                     [中文](https://github.com/dotnetcore/CAP/blob/master/README.zh-cn.md)
66
[![Travis branch](https://img.shields.io/travis/dotnetcore/CAP/master.svg?label=travis-ci)](https://travis-ci.org/dotnetcore/CAP)
77
[![AppVeyor](https://ci.appveyor.com/api/projects/status/v8gfh6pe2u2laqoa/branch/master?svg=true)](https://ci.appveyor.com/project/yang-xiaodong/cap/branch/master)
88
[![NuGet](https://img.shields.io/nuget/v/DotNetCore.CAP.svg)](https://www.nuget.org/packages/DotNetCore.CAP/)
99
[![NuGet Preview](https://img.shields.io/nuget/vpre/DotNetCore.CAP.svg?label=nuget-pre)](https://www.nuget.org/packages/DotNetCore.CAP/)
1010
[![Member project of .NET Core Community](https://img.shields.io/badge/member%20project%20of-NCC-9e20c9.svg)](https://github.com/dotnetcore)
1111
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/dotnetcore/CAP/master/LICENSE.txt)
1212

13-
CAP is a library based on .Net standard, which is a solution to deal with distributed transactions, also has the function of EventBus, it is lightweight, easy to use, and efficiently.
13+
CAP is a library based on .Net standard, which is a solution to deal with distributed transactions, has the function of EventBus, it is lightweight, easy to use, and efficient.
1414

15-
In the process of building an SOA or MicroService system, we usually need to use the event to integrate each services. In the process, the simple use of message queue does not guarantee the reliability. CAP is adopted the local message table program integrated with the current database to solve the exception may occur in the process of the distributed system calling each other. It can ensure that the event messages are not lost in any case.
15+
In the process of building an SOA or MicroService system, we usually need to use the event to integrate each service. In the process, simple use of message queue does not guarantee reliability. CAP adopts local message table program integrated with the current database to solve exceptions that may occur in the process of the distributed system calling each other. It can ensure that the event messages are not lost in any case.
1616

17-
You can also use the CAP as an EventBus. The CAP provides a simpler way to implement event publishing and subscriptions. You do not need to inherit or implement any interface during the process of subscription and sending.
17+
You can also use CAP as an EventBus. CAP provides a simpler way to implement event publishing and subscriptions. You do not need to inherit or implement any interface during subscription and sending process.
1818

1919
## Architecture overview
2020

@@ -26,18 +26,19 @@ You can also use the CAP as an EventBus. The CAP provides a simpler way to imple
2626

2727
### NuGet
2828

29-
You can run the following command to install the CAP in your project.
29+
CAP can be installed in your project with the following command.
3030

3131
```
3232
PM> Install-Package DotNetCore.CAP
3333
```
3434

35-
CAP supports RabbitMQ,Kafka and AzureService as message queue, select the packages you need to install:
35+
CAP supports RabbitMQ, Kafka, AzureService, AmazonSQS as message queue, following packages are available to install:
3636

3737
```
3838
PM> Install-Package DotNetCore.CAP.Kafka
3939
PM> Install-Package DotNetCore.CAP.RabbitMQ
4040
PM> Install-Package DotNetCore.CAP.AzureServiceBus
41+
PM> Install-Package DotNetCore.CAP.AmazonSQS
4142
```
4243

4344
CAP supports SqlServer, MySql, PostgreSql,MongoDB as event log storage.
@@ -53,7 +54,7 @@ PM> Install-Package DotNetCore.CAP.MongoDB //need MongoDB 4.0+ cluster
5354

5455
### Configuration
5556

56-
First,You need to config CAP in your Startup.cs:
57+
First, you need to configure CAP in your Startup.cs:
5758

5859
```cs
5960
public void ConfigureServices(IServiceCollection services)
@@ -80,14 +81,15 @@ public void ConfigureServices(IServiceCollection services)
8081
x.UseRabbitMQ("ConnectionString");
8182
x.UseKafka("ConnectionString");
8283
x.UseAzureServiceBus("ConnectionString");
84+
x.UseAmazonSQS();
8385
});
8486
}
8587

8688
```
8789

8890
### Publish
8991

90-
Inject `ICapPublisher` in your Controller, then use the `ICapPublisher` to send message
92+
Inject `ICapPublisher` in your Controller, then use the `ICapPublisher` to send messages
9193

9294
```c#
9395
public class PublishController : Controller
@@ -135,7 +137,7 @@ public class PublishController : Controller
135137

136138
**In Controller Action**
137139

138-
Add the Attribute `[CapSubscribe()]` on Action to subscribe message:
140+
Add the Attribute `[CapSubscribe()]` on Action to subscribe to messages:
139141

140142
```c#
141143
public class PublishController : Controller
@@ -151,15 +153,15 @@ public class PublishController : Controller
151153

152154
**In Business Logic Service**
153155

154-
If your subscribe method is not in the Controller,then your subscribe class need to Inheritance `ICapSubscribe`:
156+
If your subscription method is not in the Controller, then your subscribe class needs to implement `ICapSubscribe` interface:
155157

156158
```c#
157159

158160
namespace BusinessCode.Service
159161
{
160162
public interface ISubscriberService
161163
{
162-
public void CheckReceivedMessage(DateTime datetime);
164+
void CheckReceivedMessage(DateTime datetime);
163165
}
164166

165167
public class SubscriberService: ISubscriberService, ICapSubscribe
@@ -173,7 +175,7 @@ namespace BusinessCode.Service
173175

174176
```
175177

176-
Then inject your `ISubscriberService` class in Startup.cs
178+
Then register your class that implements `ISubscriberService` in Startup.cs
177179

178180
```c#
179181
public void ConfigureServices(IServiceCollection services)
@@ -187,15 +189,30 @@ public void ConfigureServices(IServiceCollection services)
187189
});
188190
}
189191
```
192+
#### Use partials for topic subscriptions
193+
194+
To group topic subscriptions on class level you're able to define a subscription on a method as a partial. Subscriptions on the message queue will then be a combination of the topic defined on the class and the topic defined on the method. In the following example the `Create(..)` function will be invoked when receiving a message on `customers.create`
195+
196+
```c#
197+
[CapSubscribe("customers")]
198+
public class CustomersSubscriberService : ICapSubscribe
199+
{
200+
[CapSubscribe("create", isPartial: true)]
201+
public void Create(Customer customer)
202+
{
203+
}
204+
}
205+
```
206+
190207

191208
#### Subscribe Group
192209

193210
The concept of a subscription group is similar to that of a consumer group in Kafka. it is the same as the broadcast mode in the message queue, which is used to process the same message between multiple different microservice instances.
194211

195-
When CAP startup, it will use the current assembly name as the default group name, if multiple same group subscribers subscribe the same topic name, there is only one subscriber can receive the message.
212+
When CAP startups, it will use the current assembly name as the default group name, if multiple same group subscribers subscribe to the same topic name, there is only one subscriber that can receive the message.
196213
Conversely, if subscribers are in different groups, they will all receive messages.
197214

198-
In the same application, you can specify the `Group` property to keep they are in different subscribe groups:
215+
In the same application, you can specify `Group` property to keep subscriptions in different subscribe groups:
199216

200217
```C#
201218

@@ -212,7 +229,7 @@ public void ShowTime2(DateTime datetime)
212229
```
213230
`ShowTime1` and `ShowTime2` will be called at the same time.
214231

215-
BTW, You can specify the default group name in the configuration :
232+
BTW, You can specify the default group name in the configuration:
216233

217234
```C#
218235
services.AddCap(x =>
@@ -224,13 +241,13 @@ services.AddCap(x =>
224241

225242
### Dashboard
226243

227-
CAP v2.1+ provides the dashboard pages, you can easily view the sent and received messages. In addition, you can also view the message status in real time on the dashboard. Use the following command to install the Dashboard in your project.
244+
CAP v2.1+ provides dashboard pages, you can easily view messages that were sent and received. In addition, you can also view the message status in real time in the dashboard. Use the following command to install the Dashboard in your project.
228245

229246
```
230247
PM> Install-Package DotNetCore.CAP.Dashboard
231248
```
232249

233-
In the distributed environment, the dashboard built-in integrated [Consul](http://consul.io) as a node discovery, while the realization of the gateway agent function, you can also easily view the node or other node data, It's like you are visiting local resources.
250+
In the distributed environment, the dashboard built-in integrates [Consul](http://consul.io) as a node discovery, while the realization of the gateway agent function, you can also easily view the node or other node data, It's like you are visiting local resources.
234251

235252
```c#
236253
services.AddCap(x =>
@@ -253,7 +270,7 @@ services.AddCap(x =>
253270
});
254271
```
255272

256-
The default dashboard address is :[http://localhost:xxx/cap](http://localhost:xxx/cap), you can also configure the `/cap` suffix with `x.UseDashboard(opt =>{ opt.MatchPath="/mycap"; })`.
273+
The default dashboard address is :[http://localhost:xxx/cap](http://localhost:xxx/cap), you can configure relative path `/cap` with `x.UseDashboard(opt =>{ opt.MatchPath="/mycap"; })`.
257274

258275
![dashboard](http://images2017.cnblogs.com/blog/250417/201710/250417-20171004220827302-189215107.png)
259276

README.zh-cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ namespace xxx.Service
174174
{
175175
public interface ISubscriberService
176176
{
177-
public void CheckReceivedMessage(DateTime datetime);
177+
void CheckReceivedMessage(DateTime datetime);
178178
}
179179

180180
public class SubscriberService: ISubscriberService, ICapSubscribe

appveyor.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ build_script:
1212
- ps: flubu
1313
test: off
1414
artifacts:
15-
- path: artifacts/*.nupkg
15+
- path: artifacts/**
1616
deploy:
1717
provider: NuGet
1818
on:
1919
appveyor_repo_tag: true
2020
api_key:
2121
secure: PZXRBOGLyhYLP7ulHfrh6MnkqB8CstuitgbLcJr3cZkLJLLzPH0ahvuTtmhWxtR2
22-
skip_symbols: true
23-
artifact: /artifacts\/.+\.nupkg/
22+
skip_symbols: false
23+
artifact: /artifacts\/.+\.s?nupkg/

build/BuildScript.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>netstandard2.1</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

build/version.props

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionMajor>3</VersionMajor>
4-
<VersionMinor>1</VersionMinor>
3+
<VersionMajor>5</VersionMajor>
4+
<VersionMinor>0</VersionMinor>
55
<VersionPatch>0</VersionPatch>
66
<VersionQuality></VersionQuality>
77
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>

docs/content/about/license.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**MIT License**
44

5-
Copyright (c) 2016 - 2019 Savorboard
5+
Copyright (c) 2016 - 2020 Savorboard
66

77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)