Я хочу отправлять сообщения в DLQ, когда возникает исключение при отправке в обычные очереди. Я сделал конфигурацию RabbitMQ весной, но все же сообщения не отправляются в DLQ, когда есть исключение.
@Bean
TopicExchange exchange()
{
return new TopicExchange(rabbitTemplate.getExchange());
}
@Bean
Queue dlqNotificationQueue () {
Map<String, Object> arguments = new HashMap<>()
arguments.put("x-dead-letter-exchange", rabbitTemplate.getExchange());
arguments.put("x-dead-letter-routing-key", dqlNotificationQueueName);
Queue queue = new Queue(dqlNotificationQueueName, true, false, false, arguments)
return queue
}
@Bean
Binding binding(Queue notificationQueue, TopicExchange exchange)
{
return BindingBuilder.bind(notificationQueue).to(exchange).with(notificationQueueName);
}
@Bean
Binding bindingDeadLetter(Queue dlqNotificationQueue, TopicExchange exchange)
{
return BindingBuilder.bind(dlqNotificationQueue).to(exchange).with(dqlNotificationQueueName);
}
@ Bean
RabbitListenerErrorHandler errorHandler () {
вернуть новый com.bisnode.vinland.ng.companygsrl7service.batchservice.RabbitRetryHandler ()
}
Не уверен, если мне нужно настроить больше