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
96ff6a55
Commit
96ff6a55
authored
Jul 31, 2017
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support multiple topic subscribe.
parent
f8759398
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
RabbitMQConsumerClient.cs
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs
+11
-10
No files found.
src/DotNetCore.CAP.RabbitMQ/RabbitMQConsumerClient.cs
View file @
96ff6a55
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
...
...
@@ -51,6 +52,16 @@ namespace DotNetCore.CAP.RabbitMQ
_channel
.
QueueDeclare
(
_queueName
,
exclusive
:
false
);
}
public
void
Subscribe
(
IEnumerable
<
string
>
topics
)
{
if
(
topics
==
null
)
throw
new
ArgumentNullException
(
nameof
(
topics
));
foreach
(
var
topic
in
topics
)
{
_channel
.
QueueBind
(
_queueName
,
_exchageName
,
topic
);
}
}
public
void
Listening
(
TimeSpan
timeout
,
CancellationToken
cancellationToken
)
{
var
consumer
=
new
EventingBasicConsumer
(
_channel
);
...
...
@@ -63,16 +74,6 @@ namespace DotNetCore.CAP.RabbitMQ
}
}
public
void
Subscribe
(
string
topic
)
{
_channel
.
QueueBind
(
_queueName
,
_exchageName
,
topic
);
}
public
void
Subscribe
(
string
topic
,
int
partition
)
{
_channel
.
QueueBind
(
_queueName
,
_exchageName
,
topic
);
}
public
void
Commit
()
{
_channel
.
BasicAck
(
_deliveryTag
,
false
);
...
...
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