Search code examples
javaspring-rabbitspring-cloud-stream

Do i have to use "Spring Rabbit" instead of "Spring Cloud Stream"


I'm working on a project which tries to adopt messaging-driven framework. (Different independent components communicate with the messages routed by message broker)

RabbitMQ was chosen as the Broker finally.

For the framework, at first we try to use Spring Cloud Stream, but when we try to leverage Rabbit characteristics, such as: Exchange, routing key, alternate exchange... We find it hard to use them in Spring Cloud Stream.

So my question is:

  • Do i have to use Spring Rabbit (or maybe Spring Integration) instead of Spring Cloud Stream?
  • Do you have any suggestions/best practices about them?

Solution

  • Spring Cloud Stream is very opinionated about queues, exchanges, routing keys; we are considering adding more flexibility in a future release but, for now, you can use Spring AMQP directly and it's not a lot different - @RabbitListener instead of @StreamListener for example. Whether or not you add Spring Integration as well really depends on what your application needs are.