Try PubSub+

How to trigger a solace supplier

VarunDamaniVarunDamani Member Posts: 5
edited July 5 in PubSub+ Event Broker #1

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

  • AaronAaron Member, Moderator, Employee Posts: 233 Solace Employee

    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?

  • TomFTomF Member, Employee Posts: 246 Solace Employee

    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.

  • VarunDamaniVarunDamani Member Posts: 5
    edited July 5 #4

    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

  • marcmarc Member, Administrator, Moderator, Employee Posts: 472 admin

    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 the send method in the MessageService class which uses StreamBridge in this way.

  • marcmarc Member, Administrator, Moderator, Employee Posts: 472 admin

    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.

  • VarunDamaniVarunDamani Member Posts: 5

    Hi @marc , thanks for the suggestion and resource link. I will try it out.

Sign In or Register to comment.