Topic dispatching with guaranteed delivery using JCSMP

Options

Hi there,

The article here explains how one can have custom callback to handle guaranteed messages received with matching topics thru flows bound to queues using Java RTO. Is there something similar for the JCSMP API, or another way that we can achieve something like that?

On a related note, there's normally only be one active flow per queue, but with this feature, is it one active flow per topic subscription per queue? If so, how does it work if a message matches multiple topic subscriptions?

Essentially, what I am trying to achieve is multiple subscribers within the same app (with possible overlap in terms of intended messages), but I am trying to avoid the if-else blocks for the handlers if possible. So I was wondering if this feature could come in handy because even with the selectors set in the flows, only one flow ever remains active, so I am having to have a common handler to consume the guaranteed messages from the queue before delegating based on the topic on the message.

Tagged:

Best Answer

  • amackenzie
    amackenzie Member, Employee Posts: 260 Solace Employee
    #2 Answer ✓
    Options

    JCSMP does not support topic dispatch. The feature is specific to the C-API and its derivatives (which Java RTO is one).

    In the new Java API recently released, the use case you mention is a fundamental part of its design. You define a MessagingService and on that you can define multiple MessageReceivers which each have their own subscription list. Thus you get a message handler per receiver and the subs can be set up in an even more versatile way than with Topic Dispatch.

Answers

  • amackenzie
    amackenzie Member, Employee Posts: 260 Solace Employee
    #3 Answer ✓
    Options

    JCSMP does not support topic dispatch. The feature is specific to the C-API and its derivatives (which Java RTO is one).

    In the new Java API recently released, the use case you mention is a fundamental part of its design. You define a MessagingService and on that you can define multiple MessageReceivers which each have their own subscription list. Thus you get a message handler per receiver and the subs can be set up in an even more versatile way than with Topic Dispatch.

  • mystarrocks
    mystarrocks Member Posts: 10
    edited January 2022 #4
    Options

    Great, I just came across this video of yours and some code samples here: https://github.com/SolaceSamples/solace-samples-java. I will try it out myself, but that certainly answers my question. Thanks!

    https://www.youtube.com/watch?v=S9bjuT6vcNQ