0

I've noticed that @Output -> @StreamListener approach has been deprecated and totally rewritten, to be used with Supplier/Consumer approach. It's said that all functionalities has been preserved in new approach, so I'm looking for a good article/blogpost, which will help me to migrate. For example I see that there are different dependencies (pom.xml needs to be changed), binding to for example RabbitMQ needs t be configured differently etc. Can you help?

Marx
  • 804
  • 10
  • 23

1 Answers1

1

Here it is https://spring.io/blog/2019/10/14/spring-cloud-stream-demystified-and-simplified and then this although it touches on reactive part which you may not need https://spring.io/blog/2019/10/17/spring-cloud-stream-functional-and-reactive And then all our samples have been migrated to functional - https://github.com/spring-cloud/spring-cloud-stream-samples And of course reference docs have all been updatd with all new code snippets and samples

Oleg Zhurakousky
  • 5,820
  • 16
  • 17
  • Those two articles only scratches the surface. I'll dig through examples (maaany of them) but there's no migration guide? For example, how to migrate "condition"? I simple need to send message from one microservice to another. Can you recommend one example of such use case? – Marx Sep 09 '21 at 17:29
  • RoutingFunction, there is a section in the reference manual – Oleg Zhurakousky Sep 10 '21 at 08:17
  • Honestly I found RoutingFunction quick complex to understand and apply to real life situation when I basically use to filter message by its type. StreamListener is behind the scenes a single Sink split in multiple methods that are filtering the message by certain criteria. I would implement such filters programmatically in the component holding `@Bean public Consumer funName` – Rogério Ramos Jan 16 '22 at 19:36
  • @Rogerio Ramos I am not sure what do your mean by "complex", "apply to real life situation" etc. . .. Without concrete examples it's an empty, meaningless statement, so please refrain from it – Oleg Zhurakousky Jan 17 '22 at 13:04
  • @OlegZhurakousky using the imperative style (StreamListener) it was simple to filter messages by one of its headers or payload fields, but in the example a boolean unary filter was used executing `even` or `odd` function which does not represent real life usage as asked here https://spring.io/blog/2019/10/17/spring-cloud-stream-functional-and-reactive#comment-5551299810. Also using `StreamBridge` is way intuitive compared to `Supplier` do you have something else than String transformation for Producer examples? – Rogério Ramos Jan 19 '22 at 20:49
  • 1
    @Rogerio Ramos Yes, it is even easier and far more dynamic to do routing bu headers with property (e.g., `spring.cloud.function.routing-expression=headers['type']`). And then there is `MessageRoutingCallback` if routing/filtering logic is too complex - https://docs.spring.io/spring-cloud-function/docs/3.1.6/reference/html/spring-cloud-function.html#_function_routing_and_filtering – Oleg Zhurakousky Jan 21 '22 at 07:26