De-Duplicate Messages in JMS - getReplicationGroupMessageId not part of JMS Spec
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
-
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
Richard0
Answers
-
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
Richard0