+

Search Tips | Advanced Search

Example: Splitting a single file into multiple messages by length

We can split a file into multiple IBM MQ messages by using the -qs parameter of the fteCreateTransfer command. The file is split into fixed-length sections, each of which is written to an individual message.


About this task

The source file is called /tmp/source.file and is 36 KB in size. The source file is located on the same system as the source agent AGENT_NEPTUNE. The source agent, AGENT_NEPTUNE, connects to the queue manager QM_NEPTUNE. The destination agent is AGENT_MERCURY, which connects to the queue manager QM_MERCURY. The destination queue, RECEIVING_QUEUE, is also located on the queue manager QM_MERCURY. The transfer splits the source file into sections that are 1 KB in size and writes each of these sections to a message on RECEIVING_QUEUE.


Procedure

Type the following command:
fteCreateTransfer -sa AGENT_NEPTUNE -sm QM_NEPTUNE -da AGENT_MERCURY -dm QM_MERCURY 
                  -dq RECEIVING_QUEUE -qs 1K /tmp/source.file

The source agent, AGENT_NEPTUNE, reads the data from the file /tmp/source.file and transfers this data to the destination agent, AGENT_MERCURY. The destination agent, AGENT_MERCURY, writes the data to thirty-six 1 KB persistent messages on the queue RECEIVING_QUEUE@QM_MERCURY. These messages all have the same IBM MQ group ID and the last message in the group has the IBM MQ LAST_MSG_IN_GROUP flag set.