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
bbc824ad
Commit
bbc824ad
authored
Oct 29, 2018
by
Savorboard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:dotnetcore/CAP into develop
parents
b7abc4a1
86868f5f
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
84 additions
and
47 deletions
+84
-47
CAP.sln
CAP.sln
+1
-0
Directory.Build.props
Directory.Build.props
+25
-14
README.md
README.md
+8
-5
DotNetCore.CAP.Kafka.csproj
src/DotNetCore.CAP.Kafka/DotNetCore.CAP.Kafka.csproj
+1
-1
DotNetCore.CAP.MySql.csproj
src/DotNetCore.CAP.MySql/DotNetCore.CAP.MySql.csproj
+1
-1
DotNetCore.CAP.PostgreSql.csproj
...otNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj
+1
-1
SnowflakeId.cs
src/DotNetCore.CAP/Infrastructure/SnowflakeId.cs
+13
-6
DotNetCore.CAP.MongoDB.Test.csproj
...tCore.CAP.MongoDB.Test/DotNetCore.CAP.MongoDB.Test.csproj
+6
-3
DotNetCore.CAP.MySql.Test.csproj
...otNetCore.CAP.MySql.Test/DotNetCore.CAP.MySql.Test.csproj
+7
-4
DotNetCore.CAP.PostgreSql.Test.csproj
...CAP.PostgreSql.Test/DotNetCore.CAP.PostgreSql.Test.csproj
+7
-4
DotNetCore.CAP.SqlServer.Test.csproj
...e.CAP.SqlServer.Test/DotNetCore.CAP.SqlServer.Test.csproj
+7
-4
DotNetCore.CAP.Test.csproj
test/DotNetCore.CAP.Test/DotNetCore.CAP.Test.csproj
+7
-4
No files found.
CAP.sln
View file @
bbc824ad
...
@@ -31,6 +31,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{10C0818D
...
@@ -31,6 +31,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{10C0818D
build.cake = build.cake
build.cake = build.cake
build.ps1 = build.ps1
build.ps1 = build.ps1
build.sh = build.sh
build.sh = build.sh
Directory.Build.props = Directory.Build.props
build\index.cake = build\index.cake
build\index.cake = build\index.cake
build\util.cake = build\util.cake
build\util.cake = build\util.cake
build\version.cake = build\version.cake
build\version.cake = build\version.cake
...
...
Directory.Build.props
View file @
bbc824ad
<Project>
<Project>
<Import Project="build\version.props" />
<Import Project="build\version.props" />
<PropertyGroup Label="Package">
<PropertyGroup Label="Package">
<Product>CAP</Product>
<Product>CAP</Product>
<Authors>.NET Core Community;Savorboard</Authors>
<Authors>.NET Core Community;Savorboard</Authors>
<RepositoryUrl>https://github.com/dotnetcore/CAP</RepositoryUrl>
<RepositoryUrl>https://github.com/dotnetcore/CAP</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryType>git</RepositoryType>
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
<PackageIconUrl>https://avatars2.githubusercontent.com/u/19404084</PackageIconUrl>
<PackageIconUrl>https://avatars2.githubusercontent.com/u/19404084</PackageIconUrl>
<PackageProjectUrl>https://github.com/dotnetcore/CAP</PackageProjectUrl>
<PackageProjectUrl>https://github.com/dotnetcore/CAP</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/dotnetcore/CAP/blob/master/LICENSE.txt</PackageLicenseUrl>
<PackageLicenseUrl>https://github.com/dotnetcore/CAP/blob/master/LICENSE.txt</PackageLicenseUrl>
<PackageTags>CAP;EventBus;Distributed Transaction</PackageTags>
<PackageTags>CAP;EventBus;Distributed Transaction</PackageTags>
<Description>EventBus and eventually consistency in distributed architectures.</Description>
<Description>EventBus outbox integration and eventually consistency in microservice architectures.</Description>
</PropertyGroup>
</PropertyGroup>
<!-- Using SourceLink -->
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All"/>
</ItemGroup>
</Project>
</Project>
\ No newline at end of file
README.md
View file @
bbc824ad
...
@@ -104,7 +104,7 @@ public class PublishController : Controller
...
@@ -104,7 +104,7 @@ public class PublishController : Controller
{
{
using
(
var
transaction
=
connection
.
BeginTransaction
(
_capBus
,
autoCommit
:
true
))
using
(
var
transaction
=
connection
.
BeginTransaction
(
_capBus
,
autoCommit
:
true
))
{
{
//your business code
//your business
logic
code
_capBus
.
Publish
(
"xxx.services.show.time"
,
DateTime
.
Now
);
_capBus
.
Publish
(
"xxx.services.show.time"
,
DateTime
.
Now
);
}
}
...
@@ -118,7 +118,7 @@ public class PublishController : Controller
...
@@ -118,7 +118,7 @@ public class PublishController : Controller
{
{
using
(
var
trans
=
dbContext
.
Database
.
BeginTransaction
(
_capBus
,
autoCommit
:
true
))
using
(
var
trans
=
dbContext
.
Database
.
BeginTransaction
(
_capBus
,
autoCommit
:
true
))
{
{
//your business code
//your business
logic
code
_capBus
.
Publish
(
"xxx.services.show.time"
,
DateTime
.
Now
);
_capBus
.
Publish
(
"xxx.services.show.time"
,
DateTime
.
Now
);
}
}
...
@@ -131,7 +131,7 @@ public class PublishController : Controller
...
@@ -131,7 +131,7 @@ public class PublishController : Controller
### Subscribe
### Subscribe
**In
Action Method
**
**In
Controller Action
**
Add the Attribute
`[CapSubscribe()]`
on Action to subscribe message:
Add the Attribute
`[CapSubscribe()]`
on Action to subscribe message:
...
@@ -147,7 +147,7 @@ public class PublishController : Controller
...
@@ -147,7 +147,7 @@ public class PublishController : Controller
```
```
**In
Service Method
**
**In
Business Logic Service
**
If your subscribe method is not in the Controller,then your subscribe class need to Inheritance
`ICapSubscribe`
:
If your subscribe method is not in the Controller,then your subscribe class need to Inheritance
`ICapSubscribe`
:
...
@@ -179,7 +179,10 @@ public void ConfigureServices(IServiceCollection services)
...
@@ -179,7 +179,10 @@ public void ConfigureServices(IServiceCollection services)
//Note: The injection of services needs before of `services.AddCap()`
//Note: The injection of services needs before of `services.AddCap()`
services
.
AddTransient
<
ISubscriberService
,
SubscriberService
>();
services
.
AddTransient
<
ISubscriberService
,
SubscriberService
>();
services
.
AddCap
(
x
=>{});
services
.
AddCap
(
x
=>
{
//...
});
}
}
```
```
...
...
src/DotNetCore.CAP.Kafka/DotNetCore.CAP.Kafka.csproj
View file @
bbc824ad
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<PackageReference Include="Confluent.Kafka" Version="0.11.
5
" />
<PackageReference Include="Confluent.Kafka" Version="0.11.
6
" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
...
...
src/DotNetCore.CAP.MySql/DotNetCore.CAP.MySql.csproj
View file @
bbc824ad
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.0" />
<PackageReference Include="MySqlConnector" Version="0.4
3.0
" />
<PackageReference Include="MySqlConnector" Version="0.4
6.1
" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
...
...
src/DotNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj
View file @
bbc824ad
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.0" />
<PackageReference Include="Npgsql" Version="4.0.
2
" />
<PackageReference Include="Npgsql" Version="4.0.
3
" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
...
...
src/DotNetCore.CAP/Infrastructure/SnowflakeId.cs
View file @
bbc824ad
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
// An object that generates IDs. This is broken into a separate class in case we ever want to support multiple worker threads per process
// An object that generates IDs. This is broken into a separate class in case we ever want to support multiple worker threads per process
using
System
;
using
System
;
using
System.Threading
;
namespace
DotNetCore.CAP.Infrastructure
namespace
DotNetCore.CAP.Infrastructure
{
{
...
@@ -24,10 +23,10 @@ namespace DotNetCore.CAP.Infrastructure
...
@@ -24,10 +23,10 @@ namespace DotNetCore.CAP.Infrastructure
private
static
SnowflakeId
_snowflakeId
;
private
static
SnowflakeId
_snowflakeId
;
private
readonly
object
_lock
=
new
object
();
private
readonly
object
_lock
=
new
object
();
private
static
readonly
object
s_l
ock
=
new
object
();
private
static
readonly
object
SL
ock
=
new
object
();
private
long
_lastTimestamp
=
-
1L
;
private
long
_lastTimestamp
=
-
1L
;
p
rivate
SnowflakeId
(
long
workerId
,
long
datacenterId
,
long
sequence
=
0L
)
p
ublic
SnowflakeId
(
long
workerId
,
long
datacenterId
,
long
sequence
=
0L
)
{
{
WorkerId
=
workerId
;
WorkerId
=
workerId
;
DatacenterId
=
datacenterId
;
DatacenterId
=
datacenterId
;
...
@@ -46,11 +45,19 @@ namespace DotNetCore.CAP.Infrastructure
...
@@ -46,11 +45,19 @@ namespace DotNetCore.CAP.Infrastructure
public
long
Sequence
{
get
;
internal
set
;
}
public
long
Sequence
{
get
;
internal
set
;
}
public
static
SnowflakeId
Default
(
long
datacenterId
=
0
)
public
static
SnowflakeId
Default
()
{
{
lock
(
s_l
ock
)
lock
(
SL
ock
)
{
{
return
_snowflakeId
??
(
_snowflakeId
=
new
SnowflakeId
(
Thread
.
CurrentThread
.
ManagedThreadId
,
datacenterId
));
if
(
_snowflakeId
!=
null
)
{
return
_snowflakeId
;
}
var
random
=
new
Random
();
var
workerId
=
random
.
Next
((
int
)
MaxWorkerId
);
var
datacenterId
=
random
.
Next
((
int
)
MaxDatacenterId
);
return
_snowflakeId
=
new
SnowflakeId
(
workerId
,
datacenterId
);
}
}
}
}
...
...
test/DotNetCore.CAP.MongoDB.Test/DotNetCore.CAP.MongoDB.Test.csproj
View file @
bbc824ad
...
@@ -10,9 +10,12 @@
...
@@ -10,9 +10,12 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="FluentAssertions" Version="5.4.1" />
<PackageReference Include="FluentAssertions" Version="5.4.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
...
...
test/DotNetCore.CAP.MySql.Test/DotNetCore.CAP.MySql.Test.csproj
View file @
bbc824ad
...
@@ -12,12 +12,15 @@
...
@@ -12,12 +12,15 @@
<ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
<PackageReference Include="xunit" Version="2.3.1" />
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.0" />
<PackageReference Include="Moq" Version="4.
9
.0" />
<PackageReference Include="Moq" Version="4.
10
.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.0" />
...
...
test/DotNetCore.CAP.PostgreSql.Test/DotNetCore.CAP.PostgreSql.Test.csproj
View file @
bbc824ad
...
@@ -7,10 +7,13 @@
...
@@ -7,10 +7,13 @@
<ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Npgsql" Version="4.0.2" />
<PackageReference Include="Npgsql" Version="4.0.3" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
...
...
test/DotNetCore.CAP.SqlServer.Test/DotNetCore.CAP.SqlServer.Test.csproj
View file @
bbc824ad
...
@@ -12,13 +12,16 @@
...
@@ -12,13 +12,16 @@
<ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Dapper" Version="1.50.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.
7.2
" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.
9.0
" />
<PackageReference Include="System.Data.SqlClient" Version="4.5.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
<PackageReference Include="xunit" Version="2.3.1" />
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.0" />
<PackageReference Include="Moq" Version="4.
9
.0" />
<PackageReference Include="Moq" Version="4.
10
.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.0" />
...
...
test/DotNetCore.CAP.Test/DotNetCore.CAP.Test.csproj
View file @
bbc824ad
...
@@ -6,13 +6,16 @@
...
@@ -6,13 +6,16 @@
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.
7.2
" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.
9.0
" />
<PackageReference Include="System.Data.Common" Version="4.3.0" />
<PackageReference Include="System.Data.Common" Version="4.3.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
<PackageReference Include="xunit" Version="2.3.1" />
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.0" />
<PackageReference Include="Moq" Version="4.
9
.0" />
<PackageReference Include="Moq" Version="4.
10
.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
</ItemGroup>
</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