Search code examples
javaspring-cloud-stream

stream bridge add partition number when send to non-partition topic


I have producer which use StreamBridge to send msg to a partition topic, after thatc I have a consumer which listen to a partition topic like below, and after some handling it will publish a event to a non-partition topic.

But i found that it will automatically add the partition number in the end of my non-partition topic, and the partition number is same as the one which consumer receive.

Any one know why? Thanks

 @Bean
    Consumer<Message<HcpEvent>> receiveSuccessFromHcp(){
        return message -> {
            HcpEvent hcpEvent = message.getPayload();
            // some business code
            streamBridge.send("createUser-out-0", createUserEvent);
        } ;
    }

Solution

  • After I debug, I found that when use StreamBridge sent to partition topic first, after that when you use it to send to non-partition topic, it will reuse the previous one, which include the partition handler within it. I copy the code in it and manually remove the partition handler, only for sending msg to non-partition topic.