Playing Back a Replay Log

There are three Solace CLI commands that allow you to control message playback from an event broker.

You can also initiate playback using PubSub+ Broker Manager. For more information, see:

For information about starting replay from a client, see Client Initiated Replay.

Initiating the Replay of Logged Messages

The start-replay command initiates a replay of logged messages from the replay log to the provided endpoint.

solace> enable
solace# admin
solace(admin)# message-spool message-vpn <vpn-name>
solace(admin/message-spool)# queue <queue-name> | topic-endpoint <topic-endpoint-name>
solace(admin/message-spool/queue|topic-endpoint)# start-replay [replay-log <replay-log>] [from-date <from-date> | after-msg <replication-group-msg-id>]

Where:

  • <vpn-name>—The name of the Message VPN.
  • <queue-name>—The name of the queue.
  • <topic-endpoint-name>—The name of the topic endpoint.
  • <replay-log>—The name of the replay log.
  • <from-date>—The format YYYY-MM-DDThh:mm:ssTZD, where TZD is the time zone designator. For example, a from-date might look like: 2018-08-13T11:34:13-04:00.
    • If the from-date is earlier than the log's creation date, the replay fails and the replay state of the endpoint is set to failed.
    • If no from-date is given, replay is initiated from the oldest available message.
  • <replication-group-msg-id>—The message after which to begin replay, identified by its replication group message ID. The provided string should be as given via a PubSub+ event broker management interface such as Solace CLI, PubSub+ Broker Manager, or SEMPv2. You can also obtain this value by converting the replication group message ID to a string using a PubSub+ Messaging API.

For an example, see Starting Replay on a Queue.

All messages stored on an endpoint are deleted prior to replay, and bound flows are unbound. PubSub+ Messaging APIs can handle this situation and automatically rebind to the endpoint. Also, upon receipt of a start-replay command, any replay already in progress on the endpoint is canceled.

Initiating a replay to a partitioned queue is not supported.

Messages that are replayed to a queue are not counted towards the queue's spool usage.

What happens to live messages received with a replaying endpoint destination?

Live messages received with a replaying endpoint as the destination won't be spooled to the endpoint, but instead are put in the replay log. These messages are replayed to the endpoint when the replay catches up to them. Endpoints that aren't undergoing replay, and have a matching topic subscription, continue to receive messages.

What happens if there are no clients bound to a replaying endpoint?

If you start a replay on an endpoint that has no clients bound to it, at most 1,000 messages are replayed to the endpoint. When clients bind, and as these messages are consumed, more messages are replayed as replay resumes.

If no clients are bound to the endpoint, and fewer than 1,000 messages are to be replayed, the endpoint immediately transitions to the Pending Complete state and starts attracting live messages.

What happens if a subscription changes during replay?

Replayed messages are based on the topic subscriptions at the start of replay. If you add, change, or remove subscriptions while replay is in progress, there is no change to the messages that are replayed.

What's the possible impact of trimming on replay?

When replaying from the beginning of the replay log, it might not be possible for a client to successfully complete a replay operation because the replay log is trimming messages faster than the client can consume them. For more information about trimming, see Trimming Message Replay Logs.

What's the impact of selectors?

We recommend that you avoid using egress selectors on queues because there are feature interactions that occur between selectors and message replay as follows:

  • If you replay to a queue that has one or more consumers and it uses egress selectors, you must ensure that the selector matches all replayed messages, otherwise message replay may not complete.
  • You can replay to a topic endpoint with an selector, but only the messages that match the topic endpoint subscription and the selector are replayed.

Replay States

Endpoints display one of the following replay states:

State Description

N/A

Message replay has never been requested for the endpoint.

Complete

The last requested replay has finished and no replay is in progress.

Initializing

A message replay has been requested and will begin after all live messages have been removed from the endpoint.

Active

Message replay is in progress. The endpoint is currently receiving messages from the replay log.

Pending Complete

Message replay has reached the end of the replay log but there are still unacknowledged replayed messages on the endpoint. New live messages are being delivered to the endpoint. However, replay can still fail, in which case the unacknowledged replayed messages would be deleted from the endpoint.

Failed

A replay has failed and the endpoint is waiting for acknowledgment of the unbind request it sent to the event broker as a failure indication.

Deleting Replay Messages on an Endpoint

The cancel-replay command deletes all replayed messages stored on the provided endpoint and disconnects bound clients. It also causes the endpoint to go into the Failed state, and causes any flows bound to the endpoint to be unbound.

solace> enable
solace# admin
solace(admin)# message-spool message-vpn <vpn-name>
solace(admin/message-spool)# queue <queue-name> | topic-endpoint <topic-endpoint-name>
solace(admin/message-spool/queue|topic-endpoint)# cancel-replay [force-complete]

Where:

  • <vpn-name>—The name of the Message VPN.
  • <queue-name>—The name of the queue.
  • <topic-endpoint-name>—The name of the topic endpoint.
  • force-complete—The parameter forces the replay to complete without waiting for bound clients to acknowledge the unsolicited unbind request and clears the Failed state.

For an example, see Canceling Replay on a Queue.

Trimming Messages from the Replay Log

The trim-logged-messages command deletes all messages from the replay log beginning with the oldest message in the log up to, but not including, <older-than-date>. For more information, see Trimming Message Replay Logs.

solace> enable
solace# admin
solace(admin)# message-spool message-vpn <vpn-name>
solace(admin/message-spool)# replay-log <replay-log-name>
solace(admin/message-spool/replay-log)# trim-logged-messages older-than-date <older-than-date>

Where:

  • <vpn-name>—The name of the Message VPN.
  • <replay-log-name>—The name of the message replay log.
  • <older-than-date>—The format YYYY-MM-DDThh:mm:ssTZD where TZD is the time zone designator. For example, an older-than-date might look like: 2018-08-13T11:34:13-04:00.

For an example, see Trimming Logged Messages.