This is the current approach suggested in the docs for producers in foreign event driven applications:
@Autowired
StreamBridge streamBridge;
....
bridge.send("binding1" , message);
bridge.send("binding2" , message);
The previous approach using EnableBinding
looked like:
MessageChannel binding1();
MessageChannel binding2();
...
binding1.send(message);
binding2.send(message);
My question is if there's any performance overhead and if there's any difference between the two approaches in terms of message throughput or polling?
There is no
@EnableBinding
any more.If your logic is really based on
MessageChannel
, see if you don't use Spring Cloud Stream wrong way. TheStreamBridge
is not for abusing all the time: better to rely on Spring Integration if logic is based on theMessageChannel
knowledge.See more info in docs: https://docs.spring.io/spring-cloud-stream/docs/4.0.0-M3/reference/html/spring-cloud-stream.html#_sending_arbitrary_data_to_an_output_e_g_foreign_event_driven_sources