How to trigger a solace supplier
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?
Comments
-
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?
0 -
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.
0 -
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 Solace0 -
Hi @VarunDamani,
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 thesend
method in the MessageService class which uses StreamBridge in this way.1 -
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.
1 -
Hi @marc , thanks for the suggestion and resource link. I will try it out.
1