Commit 3e360329 authored by 赵啸非's avatar 赵啸非

添加前端页面

parent ad8223e0
...@@ -32,11 +32,17 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb ...@@ -32,11 +32,17 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb
private Channel channel; private Channel channel;
private Connection connection; private Connection connection;
/**
* rabbmit设置
*/
private TbRabbitMqSettings rabbitMqSettings;
private volatile Set<String> queues; private volatile Set<String> queues;
public TbRabbitMqConsumerTemplate(TbRabbitMqSettings rabbitMqSettings, String topic, TbQueueMsgDecoder<T> decoder) { public TbRabbitMqConsumerTemplate(TbRabbitMqSettings rabbitMqSettings, String topic, TbQueueMsgDecoder<T> decoder) {
super(topic); super(topic);
this.decoder = decoder; this.decoder = decoder;
this.rabbitMqSettings=rabbitMqSettings;
try { try {
connection = rabbitMqSettings.getConnectionFactory().newConnection(); connection = rabbitMqSettings.getConnectionFactory().newConnection();
channel = connection.createChannel(); channel = connection.createChannel();
...@@ -61,6 +67,9 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb ...@@ -61,6 +67,9 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb
log.error("Failed to get messages from queue: {},{}" , queue,e); log.error("Failed to get messages from queue: {},{}" , queue,e);
try { try {
channel = connection.createChannel(); 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) { } catch (IOException ioException) {
ioException.printStackTrace(); ioException.printStackTrace();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment