Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
3e360329
Commit
3e360329
authored
Jul 12, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加前端页面
parent
ad8223e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
...ortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
+9
-0
No files found.
common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java
View file @
3e360329
...
...
@@ -32,11 +32,17 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb
private
Channel
channel
;
private
Connection
connection
;
/**
* rabbmit设置
*/
private
TbRabbitMqSettings
rabbitMqSettings
;
private
volatile
Set
<
String
>
queues
;
public
TbRabbitMqConsumerTemplate
(
TbRabbitMqSettings
rabbitMqSettings
,
String
topic
,
TbQueueMsgDecoder
<
T
>
decoder
)
{
super
(
topic
);
this
.
decoder
=
decoder
;
this
.
rabbitMqSettings
=
rabbitMqSettings
;
try
{
connection
=
rabbitMqSettings
.
getConnectionFactory
().
newConnection
();
channel
=
connection
.
createChannel
();
...
...
@@ -61,6 +67,9 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb
log
.
error
(
"Failed to get messages from queue: {},{}"
,
queue
,
e
);
try
{
channel
=
connection
.
createChannel
();
Map
<
String
,
Object
>
args
=
new
HashMap
<>();
args
.
put
(
"x-message-ttl"
,
Integer
.
parseInt
(
rabbitMqSettings
.
getMessageTtl
()));
channel
.
queueDeclare
(
queue
,
true
,
false
,
false
,
args
);
}
catch
(
IOException
ioException
)
{
ioException
.
printStackTrace
();
}
...
...
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