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
9edc31b0
Commit
9edc31b0
authored
Oct 18, 2017
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor.
parent
9b7c3f56
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
13 deletions
+11
-13
CapPublisherBase.cs
src/DotNetCore.CAP/Abstractions/CapPublisherBase.cs
+4
-2
IBootstrapper.Default.cs
src/DotNetCore.CAP/IBootstrapper.Default.cs
+7
-11
No files found.
src/DotNetCore.CAP/Abstractions/CapPublisherBase.cs
View file @
9edc31b0
...
@@ -112,7 +112,7 @@ namespace DotNetCore.CAP.Abstractions
...
@@ -112,7 +112,7 @@ namespace DotNetCore.CAP.Abstractions
"If you are using the EntityFramework, you do not need to use this overloaded."
);
"If you are using the EntityFramework, you do not need to use this overloaded."
);
}
}
private
async
Task
PublishWithTransAsync
(
string
name
,
string
content
)
private
Task
PublishWithTransAsync
(
string
name
,
string
content
)
{
{
var
message
=
new
CapPublishedMessage
var
message
=
new
CapPublishedMessage
{
{
...
@@ -121,11 +121,13 @@ namespace DotNetCore.CAP.Abstractions
...
@@ -121,11 +121,13 @@ namespace DotNetCore.CAP.Abstractions
StatusName
=
StatusName
.
Scheduled
StatusName
=
StatusName
.
Scheduled
};
};
await
ExecuteAsync
(
DbConnection
,
DbTransaction
,
message
);
ExecuteAsync
(
DbConnection
,
DbTransaction
,
message
);
ClosedCap
();
ClosedCap
();
PublishQueuer
.
PulseEvent
.
Set
();
PublishQueuer
.
PulseEvent
.
Set
();
return
Task
.
CompletedTask
;
}
}
private
void
PublishWithTrans
(
string
name
,
string
content
)
private
void
PublishWithTrans
(
string
name
,
string
content
)
...
...
src/DotNetCore.CAP/IBootstrapper.Default.cs
View file @
9edc31b0
...
@@ -4,12 +4,12 @@ using System.Threading;
...
@@ -4,12 +4,12 @@ using System.Threading;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Options
;
namespace
DotNetCore.CAP
namespace
DotNetCore.CAP
{
{
/// <inheritdoc />
/// <summary>
/// <summary>
/// Default implement of <see cref="IBootstrapper" />.
/// Default implement of <see cref="
T:DotNetCore.CAP.
IBootstrapper" />.
/// </summary>
/// </summary>
internal
class
DefaultBootstrapper
:
IBootstrapper
internal
class
DefaultBootstrapper
:
IBootstrapper
{
{
...
@@ -21,16 +21,14 @@ namespace DotNetCore.CAP
...
@@ -21,16 +21,14 @@ namespace DotNetCore.CAP
public
DefaultBootstrapper
(
public
DefaultBootstrapper
(
ILogger
<
DefaultBootstrapper
>
logger
,
ILogger
<
DefaultBootstrapper
>
logger
,
IOptions
<
CapOptions
>
options
,
IStorage
storage
,
IStorage
storage
,
IApplicationLifetime
appLifetime
,
IApplicationLifetime
appLifetime
,
IEnumerable
<
IProcessingServer
>
serve
rs
)
IEnumerable
<
IProcessingServer
>
processo
rs
)
{
{
_logger
=
logger
;
_logger
=
logger
;
_appLifetime
=
appLifetime
;
_appLifetime
=
appLifetime
;
Options
=
options
.
Value
;
Storage
=
storage
;
Storage
=
storage
;
Servers
=
serve
rs
;
Processors
=
processo
rs
;
_cts
=
new
CancellationTokenSource
();
_cts
=
new
CancellationTokenSource
();
_ctsRegistration
=
appLifetime
.
ApplicationStopping
.
Register
(()
=>
_ctsRegistration
=
appLifetime
.
ApplicationStopping
.
Register
(()
=>
...
@@ -47,11 +45,9 @@ namespace DotNetCore.CAP
...
@@ -47,11 +45,9 @@ namespace DotNetCore.CAP
});
});
}
}
protected
CapOptions
Options
{
get
;
}
protected
IStorage
Storage
{
get
;
}
protected
IStorage
Storage
{
get
;
}
protected
IEnumerable
<
IProcessingServer
>
Serve
rs
{
get
;
}
protected
IEnumerable
<
IProcessingServer
>
Processo
rs
{
get
;
}
public
Task
BootstrapAsync
()
public
Task
BootstrapAsync
()
{
{
...
@@ -68,7 +64,7 @@ namespace DotNetCore.CAP
...
@@ -68,7 +64,7 @@ namespace DotNetCore.CAP
if
(
_cts
.
IsCancellationRequested
)
return
;
if
(
_cts
.
IsCancellationRequested
)
return
;
foreach
(
var
item
in
Serve
rs
)
foreach
(
var
item
in
Processo
rs
)
try
try
{
{
item
.
Start
();
item
.
Start
();
...
@@ -86,7 +82,7 @@ namespace DotNetCore.CAP
...
@@ -86,7 +82,7 @@ namespace DotNetCore.CAP
{
{
_appLifetime
.
ApplicationStopping
.
Register
(()
=>
_appLifetime
.
ApplicationStopping
.
Register
(()
=>
{
{
foreach
(
var
item
in
Serve
rs
)
foreach
(
var
item
in
Processo
rs
)
item
.
Dispose
();
item
.
Dispose
();
});
});
return
Task
.
CompletedTask
;
return
Task
.
CompletedTask
;
...
...
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