Message Replay Examples

The following sections provide some simple examples of how to configure and initiate a message replay from an event broker using Solace CLI commands.

For detailed information about the Solace CLI commands shown in the examples, see these sections:

Create a Replay Log

You can create a replay log using the following commands:

solace1> enable
solace1# configure
solace1(configure)# message-spool message-vpn <vpn-name>
solace1(configure/message-spool)# create replay-log <log-name>
solace1(configure/message-spool/replay-log)# max-spool-usage <size-in-MB>
solace1(configure/message-spool/replay-log)# no shutdown
solace1(configure/message-spool/replay-log)# exit

By default, max-spool-usage size is set to 0. To log messages, the max-spool-usage size, <size-in-MB>, must be greater than 0. To determine the required size fo the replay log, see Configuring Message Replay.

Start Replay on a Queue

solace1# admin
solace1(admin)# message-spool message-vpn <vpn-name>
solace1(admin/message-spool)# queue <queue-name>
solace1(admin/message-spool/queue)# start-replay

The start-replay command in the above example starts the replay from the beginning of the log. You can specify the date and time from which you want to start the replay (start-replay from-date <from-date>) where the from-date is in the format YYYY-MM-DDThh:mm:ssTZD , and TZD is the time zone designator. For example, a date and time specific start-replay line might look like this,

solace1(admin/message-spool/queue)# start-replay from-date 2018-08-13T11:34:13-04:00

Alternatively, you can specify a replication group message ID after which you want to start the replay (start-replay after-msg <replication-group-msg-id>).

Cancel Replay on a Queue

You can cancel replay on a queue using the following commands:

solace1# admin
solace1(admin)# message-spool message-vpn <vpn-name>
solace1(admin/message-spool)# queue <queue-name>
solace1(admin/message-spool/queue)# cancel-replay

When you cancel replay, all clients are unbound. If there's an issue unbinding any of the client applications, the cancel-replay command might not succeed. You can force the command to succeed by using force-complete, however this may cause subsequent bind errors to that queue.

solace1(admin/message-spool/queue)# cancel-replay force-complete

Start Replay on a Topic-Endpoint

You can start replay on a topic command using the following commands:

solace1# admin
solace1(admin)# message-spool message-vpn <vpn-name>
solace1(admin/message-spool)# topic-endpoint <topic-endpoint-name>
solace1(admin/message-spool/topic-endpoint)# start-replay

The start-replay command in the above example starts the replay from the beginning of the log. You can specify the date and time from which you want to start the replay (start-replay from-date <from-date>) where the from-date is in the format YYYY-MM-DDThh:mm:ssTZD, and TZD is the time zone designator. For example, a date and time specific start-replay line might look like this,

solace1(admin/message-spool/topic-endpoint)# start-replay from-date 2018-08-13T11:34:13-04:00

Alternatively, you can specify a replication group message ID after which you want to start the replay (start-replay after-msg <replication-group-msg-id>) where the replication-group-msg-id 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 it by converting the replication group message ID to a string using a PubSub+ Messaging API.

Cancel Replay on a Topic-Endpoint

You can cancel replay on a topic endpoint using the following commands:

solace1# admin
solace1(admin)# message-spool message-vpn <vpn-name>
solace1(admin/message-spool)# topic-endpoint <topic-endpoint-name>
solace1(admin/message-spool/topic-endpoint)# cancel-replay

When a replay is canceled, the event broker sends an unbind to all clients bound to the endpoint and waits for an unbind ACK from each client. If you don’t want to wait for unbind acks, use the force-complete option,

solace1(admin/message-spool/topic-endpoint)# cancel-replay force-complete

Enable Replay on Temporary Queues

To enable replay on temporary queues, you can make use of queue templates to override the durability requested by the application. In this case, the API signals in a durable queue and you configure the event broker to override the durability to one that is non-durable.

Non-durable topic endpoints support replay without any further configuration.

First you create a queue template to override durability for certain queue names (in this example, all queue names of the form tmpQforReplay/).

solace1> enable
solace1# configure
solace1(configure)# message-spool message-vpn <vpn-name>
solace1(configure/message-spool)# create queue-template forReplayToTemp
solace1(configure/message-spool/queue-template)# durability-override non-durable
solace1(configure/message-spool/queue-template)# name-filter tmpQforReplay/*
solace1(configure/message-spool/queue-template)# end

Then, include the above template for queue creation for a client profile (in this example the default client profile).

solace1(configure)# client-profile default message-vpn <vpn-name>
solace1(configure/client-profile)# message-spool
solace1(configure/client-profile/message-spool)# api-queue-management
solace1(...le/message-spool/api-queue-management)# copy-from-template-on-create forReplayToTemp
solace1(...le/message-spool/api-queue-management)# end

Once enabled, applications can initiate replay to any temporary queue with the specified name or for any temporary queue created by a client with the specified profile.

Replay requests to non-durable endpoints initiated administratively via Solace CLI or SEMP are not supported.

Trim Logged Messages

You can manually trim the replay log using the following commands:

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

<older-than-date> is in the format YYYY-MM-DDThh:mm:ssTZD and TZD is the time zone designator. For example, the trim-logged-messages line might look like this:

solace1(admin/message-spool/replay-log)# trim-logged-messages older-than-date 2018-08-13T11:34:13-04:00

For more information about the trim-logged-messages command, see Deleting Messages from Replay Log Using trim-logged-messages .