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

添加前端页面

parent ad8223e0
......@@ -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();
}
......
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