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.fileThe 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.
Parent topic: Transfer data from files to messages
Related concepts
Related tasks
- Configure an agent to perform file-to-message transfers
- Example: Transferring a single file to a single message
- Example: Splitting a text file with a regular expression delimiter and including the delimiter in the messages
- Example: Splitting a text file into multiple messages using a regular expression delimiter
- Example: Setting IBM MQ message properties on a file-to-message transfer
- Example: Setting user-defined properties on a file-to-message transfer
- Starting a new file transfer
Related reference