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
b9c3a536
Commit
b9c3a536
authored
Sep 05, 2017
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed dependency injection bugs.
parent
a8ba769a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
11 deletions
+11
-11
CAP.KafkaCapOptionsExtension.cs
src/DotNetCore.CAP.Kafka/CAP.KafkaCapOptionsExtension.cs
+1
-1
CAP.RabbitMQCapOptionsExtension.cs
...otNetCore.CAP.RabbitMQ/CAP.RabbitMQCapOptionsExtension.cs
+1
-2
PublishQueueExecutor.cs
src/DotNetCore.CAP.RabbitMQ/PublishQueueExecutor.cs
+5
-4
RabbitMQConsumerClientFactory.cs
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClientFactory.cs
+2
-2
CAP.SqlServerCapOptionsExtension.cs
...NetCore.CAP.SqlServer/CAP.SqlServerCapOptionsExtension.cs
+2
-2
No files found.
src/DotNetCore.CAP.Kafka/CAP.KafkaCapOptionsExtension.cs
View file @
b9c3a536
...
@@ -21,7 +21,7 @@ namespace DotNetCore.CAP
...
@@ -21,7 +21,7 @@ namespace DotNetCore.CAP
services
.
AddSingleton
(
kafkaOptions
);
services
.
AddSingleton
(
kafkaOptions
);
services
.
AddSingleton
<
IConsumerClientFactory
,
KafkaConsumerClientFactory
>();
services
.
AddSingleton
<
IConsumerClientFactory
,
KafkaConsumerClientFactory
>();
services
.
Add
Transient
<
IQueueExecutor
,
PublishQueueExecutor
>();
services
.
Add
Singleton
<
IQueueExecutor
,
PublishQueueExecutor
>();
}
}
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP.RabbitMQ/CAP.RabbitMQCapOptionsExtension.cs
View file @
b9c3a536
...
@@ -23,9 +23,8 @@ namespace DotNetCore.CAP
...
@@ -23,9 +23,8 @@ namespace DotNetCore.CAP
services
.
AddSingleton
<
IConsumerClientFactory
,
RabbitMQConsumerClientFactory
>();
services
.
AddSingleton
<
IConsumerClientFactory
,
RabbitMQConsumerClientFactory
>();
services
.
AddSingleton
<
ConnectionPool
>();
services
.
AddSingleton
<
ConnectionPool
>();
services
.
AddScoped
(
x
=>
x
.
GetService
<
ConnectionPool
>().
Rent
());
services
.
Add
Transient
<
IQueueExecutor
,
PublishQueueExecutor
>();
services
.
Add
Singleton
<
IQueueExecutor
,
PublishQueueExecutor
>();
}
}
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP.RabbitMQ/PublishQueueExecutor.cs
View file @
b9c3a536
...
@@ -10,19 +10,19 @@ namespace DotNetCore.CAP.RabbitMQ
...
@@ -10,19 +10,19 @@ namespace DotNetCore.CAP.RabbitMQ
internal
sealed
class
PublishQueueExecutor
:
BasePublishQueueExecutor
internal
sealed
class
PublishQueueExecutor
:
BasePublishQueueExecutor
{
{
private
readonly
ILogger
_logger
;
private
readonly
ILogger
_logger
;
private
readonly
IConnection
_connection
;
private
readonly
ConnectionPool
_connectionPool
;
private
readonly
RabbitMQOptions
_rabbitMQOptions
;
private
readonly
RabbitMQOptions
_rabbitMQOptions
;
public
PublishQueueExecutor
(
public
PublishQueueExecutor
(
CapOptions
options
,
CapOptions
options
,
IStateChanger
stateChanger
,
IStateChanger
stateChanger
,
IConnection
connection
,
ConnectionPool
connectionPool
,
RabbitMQOptions
rabbitMQOptions
,
RabbitMQOptions
rabbitMQOptions
,
ILogger
<
PublishQueueExecutor
>
logger
)
ILogger
<
PublishQueueExecutor
>
logger
)
:
base
(
options
,
stateChanger
,
logger
)
:
base
(
options
,
stateChanger
,
logger
)
{
{
_logger
=
logger
;
_logger
=
logger
;
_connection
=
connection
;
_connection
Pool
=
connectionPool
;
_rabbitMQOptions
=
rabbitMQOptions
;
_rabbitMQOptions
=
rabbitMQOptions
;
}
}
...
@@ -30,7 +30,8 @@ namespace DotNetCore.CAP.RabbitMQ
...
@@ -30,7 +30,8 @@ namespace DotNetCore.CAP.RabbitMQ
{
{
try
try
{
{
using
(
var
channel
=
_connection
.
CreateModel
())
var
connection
=
_connectionPool
.
Rent
();
using
(
var
channel
=
connection
.
CreateModel
())
{
{
var
body
=
Encoding
.
UTF8
.
GetBytes
(
content
);
var
body
=
Encoding
.
UTF8
.
GetBytes
(
content
);
...
...
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClientFactory.cs
View file @
b9c3a536
...
@@ -9,10 +9,10 @@ namespace DotNetCore.CAP.RabbitMQ
...
@@ -9,10 +9,10 @@ namespace DotNetCore.CAP.RabbitMQ
private
readonly
IConnection
_connection
;
private
readonly
IConnection
_connection
;
public
RabbitMQConsumerClientFactory
(
RabbitMQOptions
rabbitMQOptions
,
IConnection
connection
)
public
RabbitMQConsumerClientFactory
(
RabbitMQOptions
rabbitMQOptions
,
ConnectionPool
pool
)
{
{
_rabbitMQOptions
=
rabbitMQOptions
;
_rabbitMQOptions
=
rabbitMQOptions
;
_connection
=
connection
;
_connection
=
pool
.
Rent
()
;
}
}
public
IConsumerClient
Create
(
string
groupId
)
public
IConsumerClient
Create
(
string
groupId
)
...
...
src/DotNetCore.CAP.SqlServer/CAP.SqlServerCapOptionsExtension.cs
View file @
b9c3a536
...
@@ -19,8 +19,8 @@ namespace DotNetCore.CAP
...
@@ -19,8 +19,8 @@ namespace DotNetCore.CAP
public
void
AddServices
(
IServiceCollection
services
)
public
void
AddServices
(
IServiceCollection
services
)
{
{
services
.
AddSingleton
<
IStorage
,
SqlServerStorage
>();
services
.
AddSingleton
<
IStorage
,
SqlServerStorage
>();
services
.
AddS
coped
<
IStorageConnection
,
SqlServerStorageConnection
>();
services
.
AddS
ingleton
<
IStorageConnection
,
SqlServerStorageConnection
>();
services
.
Add
Scoped
<
ICapPublisher
,
CapPublisher
>();
services
.
Add
Transient
<
ICapPublisher
,
CapPublisher
>();
services
.
AddTransient
<
ICallbackPublisher
,
CapPublisher
>();
services
.
AddTransient
<
ICallbackPublisher
,
CapPublisher
>();
services
.
AddTransient
<
IAdditionalProcessor
,
DefaultAdditionalProcessor
>();
services
.
AddTransient
<
IAdditionalProcessor
,
DefaultAdditionalProcessor
>();
AddSqlServerOptions
(
services
);
AddSqlServerOptions
(
services
);
...
...
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