The Tapeti command-line tool provides various operations for managing messages and queues.
Some operations, like shovel, are compatible with all types of messages. However, commands like import and export can assume JSON messages, specifically those sent by Tapeti, so your results may vary.
If specified messages are acknowledged and removed from the queue. If not messages are kept.
-n <count>, --maxcount <count>
Maximum number of messages to retrieve from the queue. If not specified all messages are exported.
-s <method>, --serialization <method>
The method used to serialize the message for import or export. Valid options: SingleFileJSON, EasyNetQHosepipe. Defaults to SingleFileJSON. See Serialization methods below for more information.
Path or filename (depending on the chosen serialization method) where the messages will be read from.
-m <message>, --message <message>
Single message to be sent, in the same format as used for SingleFileJSON. Serialization argument has no effect when using this input. Be sure to quote the entire message, and escape quotes within the message with another quote.
-c, --pipe
Messages are read from the standard input pipe, in the same format as used for SingleFileJSON. Serialization argument has no effect when using this input.
If specified publishes to the originating exchange using the original routing key. By default these are ignored and the message is published directly to the originating queue.
-s <method>, --serialization <method>
The method used to serialize the message for import or export. Valid options: SingleFileJSON, EasyNetQHosepipe. Defaults to SingleFileJSON. See Serialization methods below for more information.
Reads messages from a queue and publishes them to another queue, optionally to another RabbitMQ server.
-q <queue>, --queue <queue>
*Required*. The queue to read the messages from.
-t <queue>, --targetqueue <queue>
The target queue to publish the messages to. Defaults to the source queue if a different target host, port or virtualhost is specified. Otherwise it must be different from the source queue.
-r, --remove
If specified messages are acknowledged and removed from the queue. If not messages are kept.
-n <count>, --maxcount <count>
Maximum number of messages to retrieve from the queue. If not specified all messages are exported.
--targethost <host>
Hostname of the target RabbitMQ server. Defaults to the source host. Note that you may still specify a different targetusername for example.
--targetport <port>
AMQP port of the target RabbitMQ server. Defaults to the source port.
--targetvirtualhost <virtualhost>
Virtual host used for the target RabbitMQ connection. Defaults to the source virtualhost.
--targetusername <username>
Username used to connect to the target RabbitMQ server. Defaults to the source username.
--targetpassword <password>
Password used to connect to the target RabbitMQ server. Defaults to the source password.
Confirms the removal of the specified queue. If not provided, an interactive prompt will ask for confirmation.
--confirmpurge
Confirms the removal of the specified queue even if there still are messages in the queue. If not provided, an interactive prompt will ask for confirmation.
For importing and exporting messages, Tapeti.Cmd supports two serialization methods.
SingleFileJSON
''''''''''''''
The default serialization method. All messages are contained in a single file, where each line is a JSON document describing the message properties and it's content.
An example message (formatted as multi-line to be more readable, but keep in mind that it **must be a single line** in the export file to be imported properly):
The properties correspond to the RabbitMQ client's IBasicProperties and can be omitted if empty.
Either Body or RawBody is present. Body is used if the ContentType is set to application/json, and will contain the original message as an inline JSON object for easy manipulation. For other content types, the RawBody contains the original encoded body.
Below is a bare minimum example, assuming Tapeti style messages and the default direct-to-queue import (no --exchange parameter). Again, keep in mind that it **must be a single line** in the export file to be imported properly.
Provides compatibility with the EasyNetQ Hosepipe's dump/insert format. The source or target parameter must be a path. Each message consists of 3 files, ending in .message.txt, .properties.txt and .info.txt.