Skip to content

Replay

The AMI Replay command can be used to replay past real-time messages on a Relay.

Overview

Real-time messages are sent to an AMI Relay via the realtime messaging API, typically from feed handlers and AMI Client applications.

Any messages that have been sent to the Relay are tracked in the Relay's message log file AmiMessages.log. This log file enables previous commands to be re-run and audited if required.

This page contains instructions on setting up and running the Replay command.

Setup

Requirements

You will need the following:

  1. The log directory containing AmiMessages.log files
  2. The Relay port (ami.port=3289 by default)
  3. Telnet

Configuration

AmiMessages.log files are recorded automatically for a Relay alongside other log files. By default, these are in the amione/log directory of the Relay installation.

In the local.properties file of the Relay, set the following properties:

ami.relay.plugins.resource.root.dir=./log
ami.port=<your_port_number> # if not using the default value

Replay Command Syntax

Replay commands use the following syntax:

V|T="REPLAY"|LOGIN="<identifier>"|FILE="<messages_log_file>"

Additional optional parameters can be added in a pipe-delimited list. See the table below for a description of each parameter.

Parameter Description Example
V|T="REPLAY" Sets command to Replay V|T="REPLAY"
LOGIN String identifier for the process calling the command LOGIN="user"
FILE Name of the message log file(s) in a comma-delimited list FILE="AmiMessages.log.0001,AmiMessages.log.0002"
MAX_DELAY (Optional) Maximum delay between replay of each message in milliseconds MAX_DELAY=0
MAX_PER_SECOND (Optional) Maximum number of lines read from the log file per second MAX_PER_SECOND=1

Note

If your log directory has subdirectories, ensure the relative path is expressed in the FILE parameter. E.g: FILE="replays/AmiMessages.log.0001"

Replay Command Quickstart Guide

  1. Ensure that the Relay is correctly configured and running. Telnet into the platform's real-time streaming port (ami.port).

  2. Run the Replay command setting the LOGIN field to a string to identify your process, e.g "user":

    V|T="REPLAY"|LOGIN="user"|FILE="AmiMessages.log.0001"|MAX_DELAY=0
    

    Replace the FILE parameter with your own AmiMessages.log file(s). If successful, you should receive a Status message similar to the following from the Relay:

    M@1770296213883|Q=0|S=1|M="Replayed 5 lines from AmiMessages.log.0001 in 1 millis"