Search code examples
spring-bootspring-integrationspring-cloud-streamspring-cloud-stream-binder-kafka

Using Spring Integration Router with Spring Cloud Stream


I have been trying to use the Spring Integration's @Router with Spring Cloud Stream with Kafka binding. My understanding is that when you return a List of channel names from the method annotated with @Router they should be produced to the destined Kafka topics. But I don't see the messages being produced.

Does Spring Integration's @Router work with Spring Cloud Stream. If not, what's the alternative and how do I programmatically route to channels selected at runtime?


Solution

  • What makes you believe that Spring Integration @Router has any effect in Spring Cloud Stream? It's a completely different framework.

    Yes there are mechanisms to route FROM and TO in Spring Cloud Stream and they are described here.

    I think the specific section of interest to your use case is Routing FROM, but consider reading the full section to understand the differences and mechanisms used.