unique topic subscription id ?

Options
alinaqvi
alinaqvi Member Posts: 35
edited February 2020 in PubSub+ Event Broker #1

Is there a unique subscription id generated when we do a subscribe request to a topic (similar to a cache request id) ?

Topic solaceTopic = JCSMPFactory.onlyInstance().createTopic("abc/topic");
session.addSubscription(solaceTopic);

If I can get or add a unique id for the subscription above which would be part of the received messages then I can do a performant routing of messages internally in our app.

I appreciate that it might not be possible but asking just incase.

Many Thanks,
Ali

Comments

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 920 admin
    Options

    Hi @alinaqvi,
    Can you share more about what problem you're trying to solve? There is no given unique id when you add a subscription, however each message has a destination property where you can see what topic it was published to.

    https://docs.solace.com/API-Developer-Online-Ref-Documentation/java/com/solacesystems/jcsmp/XMLMessage.html#getDestination()

  • alinaqvi
    alinaqvi Member Posts: 35
    Options

    Hey marc,
    I am just trying to route messages(in our app internally) where I have subscribed to multiple topics within the same solace session. So basically trying to implement the missing 'topic dispatcher' functionality ourselves.
    For solcache topics I can use the cacheRequestId so I just wanted to know if its possible for normal topics.
    I guess not. Thanks for your quick reply.

  • TomF
    TomF Member, Employee Posts: 406 Solace Employee
    edited February 2020 #4
    Options

    @alinaqvi We have topic dispatch within some of our APIs: e.g. Our C and .Net APIs. It isn't support in the Java API , which appears to be the one you're using. As Marc says, you can interrogate and route messages based on the destination header property.