🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

De-Duplicate Messages in JMS - getReplicationGroupMessageId not part of JMS Spec

Robert
Robert Member Posts: 58 ✭✭
edited December 2021 in General Discussions #1

I can not see how i should access the: getReplicationGroupMessageId

https://docs.solace.com/Solace-PubSub-Messaging-APIs/API-Developer-Guide/Detecting-Duplicate-Mess.htm
as that field is not part of JMS spec ?

So only logical way i can see then to de-dup would be:

  • Enforce Publisher to send a unique id (e.g. UUID) in ApplicationMessageId and make
    use of that field for de-dup ?

Any other suggestion to detect duplicate message ? Maybe another field to use which is unique per message ?

I could not find any support for filling that property:
HDR_DUPLICATE_DETECTION_ID
which is often used as concept for de-duplication.

Best Answer

  • rlawrence
    rlawrence Member, Employee Posts: 14 Solace Employee
    #2 Answer ✓

    Yes correct, getReplicationGroupMessageId is part of Solace's JCSMP API so not directly accessible from the JMS API. However since the JMS API is built on top of the JCSMP API its possible to access this by first casting your JMS Message object to a SolMessage object as follows:

    import com.solacesystems.jcsmp.XMLMessage;
    ...
        SolMessage solMsg = (SolMessage)jmsMsg;
        String repGroupMsgId = solMsg.getMessage().getReplicationGroupMessageId().toString();
    

    Of course, this code will only work when using a Solace message broker as your JMS provider.

    HTH
    Richard

Answers

  • rlawrence
    rlawrence Member, Employee Posts: 14 Solace Employee
    #3 Answer ✓

    Yes correct, getReplicationGroupMessageId is part of Solace's JCSMP API so not directly accessible from the JMS API. However since the JMS API is built on top of the JCSMP API its possible to access this by first casting your JMS Message object to a SolMessage object as follows:

    import com.solacesystems.jcsmp.XMLMessage;
    ...
        SolMessage solMsg = (SolMessage)jmsMsg;
        String repGroupMsgId = solMsg.getMessage().getReplicationGroupMessageId().toString();
    

    Of course, this code will only work when using a Solace message broker as your JMS provider.

    HTH
    Richard