Try PubSub+

Replay from Message ID - How to use it!

marcmarc Member, Administrator, Moderator, Employee Posts: 422 admin
edited May 28 in PubSub+ Event Broker #1

Hey everyone,
The recent v9.9 release of the PubSub+ Event Broker and the API releases that came with it now support the ability to trigger replay from a specific message id. I just wanted to share some info on how to use it with some of the different APIs!

Note that the Message ID is in available in the header of each Solace Message and each Solace SMF API allows you to easily retrieve it.

Useful resources

Using CCSMP for Replay from Message ID

const string &replayMsgId = "rmid1:0117b-75462900ca8-00000000-00135082";
flowProps[propIndex++] = strdup(replayMsgId.c_str());
csmpRc = solClient_session_createFlow(
                        (char **)flowProps,

Using JCSMP for Replay from Message ID:

String replayMsgId = "rmid1:0117b-75462900ca8-00000000-00135082";  
ReplayStartLocation loc = JCSMPFactory.onlyInstance().createReplicationGroupMessageId(replayMsgId);
consumer = _jSession.createFlow(myConsumer, consFlowProps, null, myConsumer);

Using NodeJS/JavaScript for Replay from Message ID

var replayMsgId = "rmid1:0117b-75462900ca8-00000000-00135082";
messageConsumerProperties.replayStartLocation = solace.SolclientFactory.createReplicationGroupMessageId(replayMsgId);
consumer = this.m_session.createMessageConsumer(messageConsumerProperties);

Using .NET for Replay from Message ID

Note: One important thing about .NET is the ReplayStartLocation property in FlowProperties has been deprecated so it needs to use ReplayStartLocationEx (All the other replay start locations should use it as well in the future)

FlowProperties fp = new FlowProperties();
String replayMsgId = "rmid1:0117b-75462900ca8-00000000-00135082";
IReplicationGroupMessageId rpStart = ContextFactory.Instance.CreateReplicationGroupMessageId(replayMsgId);
fp.ReplayStartLocationEx = rpStart;
flowHandle = m_session.CreateFlow(fp, bindEndp

Using JavaRTO for Replay from Message ID:

Map<String, String> flowPropsMap = new HashMap<String, String>(_flowProperties);
String replayMsgId = "rmid1:0117b-75462900ca8-00000000-00135082";
flowPropsMap.put(FlowHandle.PROPERTIES.REPLAY_START_LOCATION, replayMsgId );
EventsAdapter myConsumer = new EventsAdapter(this, queue, flowProps, null, null, transactedSession, wantMsgPriorityOrderChecking);

Hope this thread comes in handy for folks trying to use this feature in the future :)
Go ahead and give it a like if it does and we'll continue to try to share content like this for future features.

Sign In or Register to comment.