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 Python for Replay from Message ID
rgmid = "rmid1:096b4-e39eaab3209-00000000-0000002d"
reply_strategy = ReplayStrategy.replication_group_message_id_based(ReplicationGroupMessageId.of(rgmid))
persistent_receiver: PersistentMessageReceiver = messaging_service.create_persistent_message_receiver_builder()\
.with_message_auto_acknowledgement()\
.with_message_replay(reply_strategy)\
.build(durable_exclusive_queue)
persistent_receiver.start()
Using CCSMP for Replay from Message ID
const string &replayMsgId = "rmid1:0117b-75462900ca8-00000000-00135082";
flowProps[propIndex++] = strdup(SOLCLIENT_FLOW_PROP_REPLAY_START_LOCATION);
flowProps[propIndex++] = strdup(replayMsgId.c_str());
csmpRc = solClient_session_createFlow(
(char **)flowProps,
session_mp,
&opaqueFlow_p,
&flowFuncInfo,
sizeof(flowFuncInfo));
Using JCSMP for Replay from Message ID:
String replayMsgId = "rmid1:0117b-75462900ca8-00000000-00135082";
ReplayStartLocation loc = JCSMPFactory.onlyInstance().createReplicationGroupMessageId(replayMsgId);
consFlowProps.setReplayStartLocation(loc);
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, bindEndpoint, topicSubscription, this._HandleMessageEvent, this._HandleFlowEvent, epProps);
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.