Putting a test message

Before you start

To complete this task, you must have completed the following tasks:

If your message flow includes MQInput and MQOutput nodes, you might want to trigger the flow by putting a test message onto the input queue for your first MQInput node. This topic tells you how to put a test message by configuring and using an enqueue file in the workbench. This is an easy and repeatable alternative to using command line interfaces or WebSphere MQ Explorer (with WebSphere MQ Version 6) or WebSphere MQ Services (with WebSphere MQ Version 5) to put a message.

If the message is processed by the message flow and is put to an output queue, you can retrieve it from that queue. See Getting a test message for details.

Configuring and using an enqueue file

To configure an enqueue file so that you can use it to send a test message:

  1. Switch to the Broker Administration perspective.
  2. On the workbench toolbar, click the arrow on the Put a message onto a queue icon Put a message onto a queue .
  3. On the drop-down menu, click Put Message... to invoke the New Enqueue Message File wizard.
  4. Select the message flow project containing the message flow that you are debugging.
  5. In the File name field, enter a name for the file to create (the extension .enqueue is added automatically).
  6. Click Finish. The enqueue file is created, and a view opens showing its details.
  7. Enter the names for the queue manager and the queue for the input node for this flow. Queue manager names are case-sensitive; check that you enter the name correctly.

    If you are putting a message on an input queue that is on a remote computer, ensure that the queue manager of the associated broker has a server-connection channel called SYSTEM.BKR.CONFIG.

  8. If you are putting a message on a remote queue, enter values to identify the host and port of the computer that is hosting the queue.
  9. Start of changeOptional: Click the MQMD tab to customize the fields of the MQMD header. Read descriptions of these fields in WebSphere MQ Application Programming Reference; the constants are listed in WebSphere MQ Constants.End of change
  10. Click File > Save to save the enqueue file.
  11. Optional: To put the message to the queue immediately from this window, click the Write to queue button.
  12. Click the arrow on the Put a message onto a queue icon Put a message onto a queue to see your enqueue file listed on the drop-down menu.
  13. Click this file on the menu, (or if it is number 1 on the menu, just click the icon itself) to put a message to the queue. If you have set appropriate breakpoints, the flow debugger pauses the flow at the next one.

To find your enqueue file at a later time, switch to the Broker Application Development perspective and expand the navigation tree for your message flow project. Double-click your enqueue file to open it in a view.

Optional: Adding data to your message

If you want just a small amount of test data in your test message, type the data into a window to quickly add some test data:

  1. Open your enqueue file and select the Browse tab.
  2. Type your test data directly into the "Message data" window.
  3. Put the test message by selecting the General tab and clicking the Write to queue button.

Optional: Using a file of sample data

If you want your test message to contain a larger quantity of sample data (for example some structured XML), first create or import a file containing that data, then get the enqueue file to use it. Follow the optional sections and steps below to use either of these methods of creating and adding data.

To get the enqueue file to use a file that contains sample data:

  1. Create or import the message data file, as described below.
  2. Open your enqueue file; at File name click the Browse button.
  3. In the "Add a message" window, select your file and click OK.
  4. Click File > Save when you have finished.
  5. To see the data in your file, select the Browse tab at the bottom of the enqueue view. If you want to change the data, either type some text into the "Message data" window, or edit the file by double-clicking it in the Resource Navigator view.
    Tip: If you decide to experiment with using an XML data file instead of text, do not forget to edit the properties for the input node of your message flow and set the Message Domain to XML. When your message appears in the Flow Debugger in the Variables view, the XML is parsed and expandable in the tree.

Optional: Creating a file of sample data for the message

To create a new file of sample data:

  1. Switch to the Broker Application Development perspective.
  2. Click File > New > Other....
  3. Click Simple, then File.
  4. In the New File window, select the project in which you want to keep the file, then at File name enter a name and extension for your file. If your file contains XML, make sure that the extension is .XML.
  5. Click Finish. The file is created and appears in the Resource Navigator view. A view opens with an appropriate editor (text or XML) for the file.
  6. Edit the file and enter the text or XML data that you want in it.
  7. Click File > Save when you have finished.

You can now select the file as described in the Optional: Using a file of sample data section. You can also double-click the file to open it in an appropriate editor.

Optional: Importing an existing file of sample data for the message

If you already have a file on your computer containing sample data that you want to use in a test message, use these steps to import the data into the workbench. If the file contains XML, make sure that it has the extension .XML.

  1. Switch to the Broker Application Development perspective.
  2. Click File > Import.
  3. In the list of wizards, select File system then click Next.
  4. At Directory, click the Browse button and navigate to the folder containing your file then click OK. A list of the files in the folder appears.
  5. In the list of files, select the check box next to the file that you want to import.
  6. At Folder, click the Browse button and select the project in which you want to keep the file.
  7. Click Finish.

After you have imported the file as described here, a copy of your file is stored in the workbench data space along with all other workbench files for your configuration. Your original file is not used directly again.

The file appears in the Resource Navigator in your chosen project, and you can select it as described in the Optional: Using a file of sample data section on this page. You can also double-click it to open it in an appropriate editor.

Related concepts
Flow debugger overview