Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Integration and Spring Cloud Stream

I am writing an application that

  • Polls the directory (Sprint Integration DSL flow)
  • Once the file is available it will put in the rabbitmq queue
  • Microservice listen to the stream RabbitMQ and process the file (this is written in Spring Cloud stream)

Now, I cannot figure out what is the best way to send the message to the RabbitMQ from Spring Integration flow service. How can I use spring-cloud stream in the Spring-Integration to publish the message to the RabbitMQ

like image 680
Makky Avatar asked Jun 13 '26 20:06

Makky


1 Answers

You just need to implement there a Source binding and use RabbitMQ Binder to produce from your source. So, the result of polling files from the directory is going to be published to the Source.OUTPUT (or your custom binding) and everything else will be done by the RabbitMQ Binder: https://docs.spring.io/spring-cloud-stream/docs/Fishtown.M3/reference/htmlsingle/#spring-cloud-stream-overview-producing-consuming-messages

Of course you can do something similar with the plain Spring Integration using an AmqpOutboundEndpoint to publish a message to the appropriate exchange on the RabbitMQ: https://docs.spring.io/spring-integration/docs/5.0.8.RELEASE/reference/html/amqp.html#amqp-outbound-channel-adapter

like image 102
Artem Bilan Avatar answered Jun 16 '26 09:06

Artem Bilan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!