I have a supplier function that will produce messages to a solace broker. By default, the supplier is called every second to generate messages. But in my case, I want to explicitly call the supplier based on an internal event. How do I do that?
How is your internal event generated / triggered? Do you have a callback handler or something in your application that gets called when this event occurs? Could you just build the Solace message and publish it from there when that occurs?
Hi @VarunDamani ,
Without more details it's difficult to be specific. The typical pattern would be to have your supplier/producer subscribe to the event(s) that trigger an update. When it receives an event it can then process the update and send that.
Hey @TomF and @Aaron , thanks for responding quickly.
The internal event that I was referring to is the event generated by an Axon server. I have an event handler function that gets called when a specific axon event is generated. And when I get a particular Axon event, I need to produce an event on Solace
I noticed you said a Supplier function that is triggered every second by default...sounds like you might be using Spring Cloud Stream?
If so you can checkout StreamBridge which allows you to send a message from wherever you need to. This project shows an example where the EndpointController class receives REST calls and sends using the send method in the MessageService class which uses StreamBridge in this way.
Ah, after I posted the previous response I saw you actually included the "spring-cloud-stream" tag. You can checkout more about StreamBridge in the "Dynamic Publishing" section of this codelab as well.
Hi @marc , thanks for the suggestion and resource link. I will try it out.