What is the performance difference between using StreamBridge and defining MessageChannel bindings using the EnableBinding annotation?

272 Views Asked by At

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?

1

There are 1 best solutions below

0
Artem Bilan On

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. The StreamBridge is not for abusing all the time: better to rely on Spring Integration if logic is based on the MessageChannel 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