@Test @SneakyThrows public void process() { System.in.read(); }
@RabbitListener( bindings = @QueueBinding( exchange = @Exchange(value = RabbitMQConstant.DEFAULT_EXCHANGE, type = ExchangeTypes.TOPIC, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT), value = @Queue(value = RabbitMQConstant.DEFAULT_QUEUE, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT, arguments = { @Argument(name = RabbitMQConstant.DEAD_LETTER_EXCHANGE, value = RabbitMQConstant.DEAD_EXCHANGE), @Argument(name = RabbitMQConstant.DEAD_LETTER_KEY, value = RabbitMQConstant.DEAD_KEY) }), key = RabbitMQConstant.DEFAULT_KEY )) @SneakyThrows public void process(@Headers Map<String, Object> headers, @Payload ExampleEvent msg) { log.info("retry consumer receive message:{headers = [" + headers + "], msg = [" + msg + "]}"); throw new RuntimeException(); }
DeadLetterConsumer { @RabbitListener( bindings = @QueueBinding( exchange = @Exchange(value = RabbitMQConstant.DEFAULT_EXCHANGE, type = ExchangeTypes.TOPIC, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT), value = @Queue(value = RabbitMQConstant.DEFAULT_QUEUE, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT, arguments = { @Argument(name = RabbitMQConstant.DEAD_LETTER_EXCHANGE, value = RabbitMQConstant.DEAD_EXCHANGE), @Argument(name = RabbitMQConstant.DEAD_LETTER_KEY, value = RabbitMQConstant.DEAD_KEY) }), key = RabbitMQConstant.DEFAULT_KEY )) @SneakyThrows public void process(@Headers Map<String, Object> headers, @Payload ExampleEvent msg) { log.info("retry consumer receive message:{headers = [" + headers + "], msg = [" + msg + "]}"); throw new RuntimeException(); } }
DeadLetterConsumer { @RabbitListener( bindings = @QueueBinding( exchange = @Exchange(value = RabbitMQConstant.DEFAULT_EXCHANGE, type = ExchangeTypes.TOPIC, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT), value = @Queue(value = RabbitMQConstant.DEFAULT_QUEUE, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT, arguments = { @Argument(name = RabbitMQConstant.DEAD_LETTER_EXCHANGE, value = RabbitMQConstant.DEAD_EXCHANGE), @Argument(name = RabbitMQConstant.DEAD_LETTER_KEY, value = RabbitMQConstant.DEAD_KEY) }), key = RabbitMQConstant.DEFAULT_KEY )) @SneakyThrows public void process(@Headers Map<String, Object> headers, @Payload ExampleEvent msg) { log.info("retry consumer receive message:{headers = [" + headers + "], msg = [" + msg + "]}"); throw new RuntimeException(); }  }
DeadLetterConsumer { @RabbitListener( bindings = @QueueBinding( exchange = @Exchange(value = RabbitMQConstant.DEFAULT_EXCHANGE, type = ExchangeTypes.TOPIC, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT), value = @Queue(value = RabbitMQConstant.DEFAULT_QUEUE, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT, arguments = { @Argument(name = RabbitMQConstant.DEAD_LETTER_EXCHANGE, value = RabbitMQConstant.DEAD_EXCHANGE), @Argument(name = RabbitMQConstant.DEAD_LETTER_KEY, value = RabbitMQConstant.DEAD_KEY) }), key = RabbitMQConstant.DEFAULT_KEY )) @SneakyThrows public void process(@Headers Map<String, Object> headers, @Payload ExampleEvent msg) { log.info("retry consumer receive message:{headers = [" + headers + "], msg = [" + msg + "]}"); throw new RuntimeException(); }  @RabbitListener( bindings = @QueueBinding( exchange = @Exchange(value = RabbitMQConstant.DEFAULT_EXCHANGE, type = ExchangeTypes.TOPIC, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT), value = @Queue(value = RabbitMQConstant.DEFAULT_QUEUE, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT, arguments = { @Argument(name = RabbitMQConstant.DEAD_LETTER_EXCHANGE, value = RabbitMQConstant.DEAD_EXCHANGE), @Argument(name = RabbitMQConstant.DEAD_LETTER_KEY, value = RabbitMQConstant.DEAD_KEY) }), key = RabbitMQConstant.DEFAULT_KEY )) @SneakyThrows void process(@Headers Map<String, Object> headers, @Payload ExampleEvent msg); @RabbitListener( bindings = @QueueBinding( exchange = @Exchange(value = RabbitMQConstant.DEAD_EXCHANGE), value = @Queue(value = RabbitMQConstant.DEAD_QUEUE, durable = RabbitMQConstant.TURE_CONSTANT), key = "#" ) ) void deadListener(@Headers Map<String, Object> headers, @Payload ExampleEvent msg); }
DeadLetterConsumer { @RabbitListener( bindings = @QueueBinding( exchange = @Exchange(value = RabbitMQConstant.DEFAULT_EXCHANGE, type = ExchangeTypes.TOPIC, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT), value = @Queue(value = RabbitMQConstant.DEFAULT_QUEUE, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT, arguments = { @Argument(name = RabbitMQConstant.DEAD_LETTER_EXCHANGE, value = RabbitMQConstant.DEAD_EXCHANGE), @Argument(name = RabbitMQConstant.DEAD_LETTER_KEY, value = RabbitMQConstant.DEAD_KEY) }), key = RabbitMQConstant.DEFAULT_KEY )) @SneakyThrows public void process(@Headers Map<String, Object> headers, @Payload ExampleEvent msg) { log.info("retry consumer receive message:{headers = [" + headers + "], msg = [" + msg + "]}"); throw new RuntimeException(); }  @RabbitListener( bindings = @QueueBinding( exchange = @Exchange(value = RabbitMQConstant.DEFAULT_EXCHANGE, type = ExchangeTypes.TOPIC, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT), value = @Queue(value = RabbitMQConstant.DEFAULT_QUEUE, durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT, arguments = { @Argument(name = RabbitMQConstant.DEAD_LETTER_EXCHANGE, value = RabbitMQConstant.DEAD_EXCHANGE), @Argument(name = RabbitMQConstant.DEAD_LETTER_KEY, value = RabbitMQConstant.DEAD_KEY) }), key = RabbitMQConstant.DEFAULT_KEY )) @SneakyThrows void process(@Headers Map<String, Object> headers, @Payload ExampleEvent msg); @RabbitListener( bindings = @QueueBinding( exchange = @Exchange(value = RabbitMQConstant.DEAD_EXCHANGE), value = @Queue(value = RabbitMQConstant.DEAD_QUEUE, durable = RabbitMQConstant.TURE_CONSTANT), key = "#" ) ) void deadListener(@Headers Map<String, Object> headers, @Payload ExampleEvent msg);  }