I'm trying to add Spring Cloud Stream to the existing project that uses Spring AMQP with RabbitMQ.
I have the following rabbit configuration:
Producer exchange name: producer.mail-sent.exchange
Consumer queue name: consumer.mail-sent.queue
On the producer's side I configure like this:
spring:
cloud:
stream:
bindings:
output:
contentType: application/json
destination: producer.mail-sent.exchange
And using the following code:
@Autowired
private Source source;
...
source.output().send(MessageBuilder.withPayload(someStuff).build());
...
On the consumer's side I have the following config:
spring:
cloud:
stream:
bindings:
input:
contentType: application/json
destination: producer.mail-sent.exchange
group: consumer.mail-sent.queue
With the following code:
@EnableBinding(Sink.class)
...
@StreamListener(Sink.INPUT)
public void handle(String someStuff) {
log.info("some stuff is received: " + someStuff);
}
And it seems that it works. :)
But! On the rabbit's side I have a new queue named producer.mail-sent.exchange.consumer.mail-sent.queue
, but I want it to use the existing queue named consumer.mail-sent.queue
.
Is there any way to achieve this?