I want to create delayed exchange from rabbitMQ plugin.
At first I tried to use spring binders as I can see, that delayed-exchange flag is available:
spring:
cloud:
stream:
bindings:
delayed-ex:
group: update-delayed
contentType: application/json
consumer:
max-attempts: 1
rabbit:
bindings:
delayed-ex:
consumer:
transacted: true
auto-bind-dlq: true
republish-to-dlq: true
delayed-exchange: true
requeue-rejected: false
Unfortunately, this config is creating me simple topic exchange without any flags.
I can create bean with:
@Bean
public CustomExchange delayedExchange() {
final Map<String, Object> args = new HashMap<>();
args.put("x-delayed-type", "topic");
return new CustomExchange("delayed-ex", "x-delayed-message", true, false, args);
}
And it is working with current config, but it is giving me stacktraces about existing exchanges which I want to override:
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'delayed-ex' in vhost '/': received 'topic' but current is ''x-delayed-message'', class-id=40, method-id=10)
Another thing (don't know if it is a problem) I want to have consumer and producer in the same service, just for having buffer for my messages.
Also, I checked source of delayed-exchange flag, and saw that this flag is doing absolutely nothing (Am I wrong?), because isDelayed methods from AbstractExchange is not called.
Is it possible to declare delayed exchange with type x-delayed-message and do it by configuration, instead of declaring bean? Also I want to remove that stacktraces