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
9fd0e373
Commit
9fd0e373
authored
Jun 21, 2019
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add service name to RabbitMQ connection alias name
parent
a02ccc7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
IConnectionChannelPool.Default.cs
...DotNetCore.CAP.RabbitMQ/IConnectionChannelPool.Default.cs
+7
-4
No files found.
src/DotNetCore.CAP.RabbitMQ/IConnectionChannelPool.Default.cs
View file @
9fd0e373
...
...
@@ -4,6 +4,7 @@
using
System
;
using
System.Collections.Concurrent
;
using
System.Diagnostics
;
using
System.Reflection
;
using
System.Threading
;
using
Microsoft.Extensions.Logging
;
using
RabbitMQ.Client
;
...
...
@@ -90,6 +91,8 @@ namespace DotNetCore.CAP.RabbitMQ
private
static
Func
<
IConnection
>
CreateConnection
(
RabbitMQOptions
options
)
{
var
serviceName
=
Assembly
.
GetEntryAssembly
()?.
GetName
().
Name
.
ToLower
();
var
factory
=
new
ConnectionFactory
{
UserName
=
options
.
UserName
,
...
...
@@ -97,17 +100,17 @@ namespace DotNetCore.CAP.RabbitMQ
Password
=
options
.
Password
,
VirtualHost
=
options
.
VirtualHost
};
if
(
options
.
HostName
.
Contains
(
","
))
{
options
.
ConnectionFactoryOptions
?.
Invoke
(
factory
);
return
()
=>
factory
.
CreateConnection
(
options
.
HostName
.
Split
(
new
[]
{
","
},
StringSplitOptions
.
RemoveEmptyEntries
));
options
.
HostName
.
Split
(
new
[]
{
","
},
StringSplitOptions
.
RemoveEmptyEntries
)
,
serviceName
);
}
factory
.
HostName
=
options
.
HostName
;
options
.
ConnectionFactoryOptions
?.
Invoke
(
factory
);
return
()
=>
factory
.
CreateConnection
();
return
()
=>
factory
.
CreateConnection
(
serviceName
);
}
private
void
RabbitMQ_ConnectionShutdown
(
object
sender
,
ShutdownEventArgs
e
)
...
...
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