Stream TCS events

tcs_replay provides tcs_replay, an executable that allows the user to replay an sqlite3 database as created during TCS operation or a single mock event.

If the name of the database is provided, tcs_replay will reconstruct each TCS event and send it via a ZMQ socket approximately at the same rate at which they were created. It is possible to speedup or slowdown the rate at which events are sent and to filter events via command line options. If no database name is provided, a mock event is created and sent continuously.

Run tcs_replay -h for further information:

usage: tcs_replay [-h] [-V] [-u URL] [--wait-setup WAIT_SETUP]
                [--serve-forever] [-s SPEEDUP] [-t TOPICS [TOPICS ...]]
                [-S {none,__data_time,__wire_time}] [--convert-number]
                [--convert-bool] [--sleep SLEEP]
                [db_name]

Replays a TCS sqlite database and sends multipart events in the form of
[topic, json(event)] via a ZMQ socket.

positional arguments:
db_name               Name of the database to replay. If not given, a single
                        mock event is sent through the ZMQ socket (default:
                        None)

optional arguments:
-h, --help            show this help message and exit
-V, --version         show program's version number and exit
-u URL, --url URL     IP address and port to which bind the ZMQ socket
                        (default: tcp://127.0.0.1:5556)
--wait-setup WAIT_SETUP
                        Wait for wait_setup seconds after creating the servers
                        to allow to set up the connection (default: 1.0)
--serve-forever       Keep serving events. In the case of the database, it
                        will restart serving the database entries. (default:
                        False)

Database options:
The following options have effect only if the name of the database is
provided.

-s SPEEDUP, --speedup SPEEDUP
                        Speedup to apply when replaying the database. For
                        example, speedup=1 plays back at the original speed;
                        speedup=2 plays it twice as fast (default: 1.0)
-t TOPICS [TOPICS ...], --topics TOPICS [TOPICS ...]
                        List of topics to publish. If no topic is specified,
                        all the topics will be published. (default: None)
-S {none,__data_time,__wire_time}, --sort-by {none,__data_time,__wire_time}
                        Method to time-sort the events before serving them. If
                        'none', no sorting is done and the order of the
                        database is respected. (default: none)
--convert-number      Try to convert values marked as "number" to int or
                        float (default: False)
--convert-bool        Try to convert values marked as "boolean" to ``True``
                        or ``False`` (default: False)

Mock options:
The following options have effect only if the name of the database is not
provided.

--sleep SLEEP         Sleep for sleep seconds before emitting a new signal
                        (default: 1)

The implementation of this executable can also be used as example when using custom event generators.