Testing your message flow by using the Flow Exerciser

To check that a message flow or integration service is processing messages as expected, you can send messages to the flow by using the Flow Exerciser or an external client. You can then use the Flow Exerciser to show the path that each message took. You can also view the structure and content of the message assembly at any point in a message flow.

Before you begin

You must have the following components:
  • A resource (integration service, stand-alone message flow, application that includes a message flow, or REST API).
  • An integration node and associated integration server, or an independent integration server that is accessible from the IBM® App Connect Enterprise Toolkit.
  • If your message flow uses MQInput nodes to connect to a remote queue manager, you must have either an IBM MQ client or an IBM MQ server on the same machine as the IBM App Connect Enterprise Toolkit. To install IBM MQ components, see the IBM MQ product documentation: https://www.ibm.com/docs/en/ibm-mq.

About this task

The Flow Exerciser is a tool that is available from the flow editor and the integration service editor, but not from the REST API Editor. If you want to use the Flow Exerciser with a REST API, you must locate and open the main message flow of the REST API.

You can use the Flow Exerciser to complete the following set of tasks:
  1. Create and start an integration server to use for testing your message flow.
  2. Deploy the resource to an integration server and set the message flow to Record mode.
    1. Create and send an input message to the input node of the message flow.
    2. Send a previously saved recorded message to the input node of the message flow.

    For more information, see Messages that you can use.

    You can also send messages to the message flow by using an external client.

  3. Highlight and view the message path on the message flow and any subflows that are associated with the message flow.
  4. View the recorded message assembly for a message that passed through a connection in the message flow.
  5. Save the content of the recorded message assembly as a recorded message that you can send to the message flow later.
  6. Save the content of all message assemblies in the message path as recorded messages that you can send to the message flow later.
The following videos show examples of how to use the Flow Exerciser:
  • Understanding a message assembly shows how to use the Flow Exerciser to record and save a message assembly to be used as an input message to the flow.
  • Creating an input message shows how to use the Flow Exerciser by creating an input message to send to the flow.
  • Using an external client shows how to use the Flow Exerciser by using an external client to send a message to the flow, and how to save the message for future use.

Procedure

To check that a message flow or integration service is processing messages as expected, complete the following steps:

  1. In the IBM App Connect Enterprise Toolkit, open the message flow by completing one of the following steps:
    • If the message flow is a stand-alone message flow or a message flow that is part of an application, open the flow with the flow editor.
    • If the message flow is part of an integration service, open the integration service description with the service editor.
    • If the message flow is part of a REST API, use the message flow editor to open the main message flow of the REST API, which is located under Resources.
  2. Create or start an integration server. In the editor, click the Start Flow Exerciser icon (icon) in the Flow Exerciser toolbar so that the flow recording can start.
    Before you send a message to the message flow, you must have an integration server that is connected to the IBM App Connect Enterprise Toolkit, and the integration server must be started. If you do not have a started integration server connected to the IBM App Connect Enterprise Toolkit, a message notifies you that an integration server is required. Click OK to use the wizard that helps you create and start an integration server. For more information, see Creating, starting, and stopping a local, independent integration server by using the Toolkit.

    Alternatively, you can click Cancel and then create and start an integration server by using one of the methods described in Creating an integration server.

    When the integration server has been created and started, it is available to use for testing the message flow.

  3. Deploy the message flow. When you have one or more started integration servers that are connected to the IBM App Connect Enterprise Toolkit, click the Start Flow Exerciser icon (icon) again. The flow recording starts.

    If you have more than one started integration server that is connected to the IBM App Connect Enterprise Toolkit, you are prompted to select the integration server where you want to deploy the resource. If the message flow receives messages on an MQInput node that is configured to use a local queue manager, you can use the Flow Exerciser to send messages to that MQInput node. However, you can deploy the flow only to an integration server that is managed by a local integration node. Select the integration server where you want to deploy the message flow and click Finish.

    A window is presented where you are advised that a message flow cannot be deployed individually, and the owning application or library is deployed instead. Click OK to deploy the owning application or library to your selected integration server.

    If the resource was previously deployed to the integration server, a window is presented where you are advised that the resource is already deployed. Click Yes to confirm that you want to redeploy the resource or click No to skip the redeployment step.

    The resource is deployed to the integration server. A window is presented where you are advised that the message flow is ready to record messages. Click OK to close the window and return to the message flow editor. The flow editor is now surrounded by a blue border, and the text "Recording" appears. The red Record button is now replaced with a blue Return flow to edit mode button, and the message flow is set to Record mode. You cannot edit the message flow when it is in Record mode. If you want to stop the recording and return the flow to edit mode, press the blue Return flow to edit mode button.

  4. Send messages to the message flow by using one of the following options:
    • If you are using an integration service, or if your message flow contains MQInput, HTTPInput, or SOAPInput nodes, click the Send message icon (icon) in the Flow Exerciser toolbar. You can then use the Send Message dialog to create an input message (or select an existing input message or recorded message) and send it to the flow. For more information about creating messages or using recorded messages, see Creating input messages and Using recorded messages. The Send message function is not available for flows in a REST API.
    • If your message flow uses input nodes that the Flow Exerciser cannot send messages to directly, use an external tool or client to form and send one or more input messages to the flow.

    Click Close to close to the Send Message dialog.

  5. View the path through the flow by using one of the following methods:
    • After you click Close to close to the Send Message dialog, the message paths are automatically highlighted in blue on the flow.
    • In an integration service, click the operation name in the Integration Service Description page to see the message paths highlighted on the subflow.
    • If your message flow uses input nodes that the Flow Exerciser cannot send messages to directly, and you used an external tool or client to form and send one or more input messages to the flow, you must click the View path icon (icon) in the Flow Exerciser toolbar to highlight message paths on the flow.

    The image is described in the surrounding text.

    The diagram shows a flow where the message paths are highlighted. At least one message passed through each highlighted connection.

    • The highlighted connections do not distinguish between the paths that are taken by different messages. If you send more than one message to the flow, you must inspect each highlighted connection to see which messages passed through that connection.
    • If you send a single message to the flow and the message passes through a connection multiple times, the logical message tree is captured as a separate message instance each time the message passes through a connection.
    • By default, a maximum of 200 message instances are displayed in the message flow, but you can change this value in the preferences (Windows > Preferences > Integration Development > Flow Exerciser).
    • If the number of message instances that are captured exceeds the number that is configured in the preferences, you are prompted to choose whether to view the configured number of recorded messages, or whether to view all the recorded messages:
      • If you opt to view the configured maximum number of recorded messages, you might not see whole sequences of messages.
      • If you opt to view all the messages, performance can be impacted.
    When you finish viewing the path through the flow, choose one of the following options:
    • Click Clear Recorded Messages to clear the recorded messages. The blue line that highlights the path taken through the flow is no longer shown.
    • Click Return flow to Edit Mode to clear the recorded messages and return the message flow to Edit mode. The blue line that highlights the path taken through the flow is no longer shown. You can then edit the message flow and redeploy the flow to the integration server, as described in step 3. You can then resend the message, as described in step 4.
    • Leave the message flow in Record mode, and view the message assembly, as described in step 6.
  6. Optional: When the message flow is in Record mode, and the blue line that highlights the path taken through the flow is visible in the Flow Exerciser, you can view the recorded message assembly of the message.
    The message assembly is a logical representation of the message flow that is being handled at a particular point in the process. For more information, see Message Assembly editor.
    Open a read-only view of the message assembly by selecting a message icon that is on a connection between any two nodes in the path of the message flow.
    The image is described in the surrounding text.

    The view shows the logical message tree at that point in the flow. The logical message tree is referred to as the message assembly. The message assembly consists of four trees:

    • environment
    • localEnvironment
    • exceptionList
    • message

    The message tree contains message headers and the message body. The message body part of the message assembly is automatically expanded when the view is shown.

    A checkpoint folder is also shown in the message assembly. The checkpoint shows details of where in the flow the message was recorded. It shows the source node and the target node details.

    If you send multiple messages to the flow, you can select which message you want to view by selecting the appropriate entry in the Message number drop-down menu. When you change the selection in the Message number menu, the name of the message is automatically updated in the Name field .

    The image is described in the surrounding text.

    If you want to save the message assembly, follow the instructions in step 7.

  7. Optional: When you view the message assembly in the read-only view, you can save it by completing the following steps:
    1. Optional: You can change the name of the message assembly by overwriting the default name that appears in the Name field of the Recorded Message Assembly window. The name of the message assembly must have the extension .mxml.
    2. Click Save.
    The image is described in the surrounding text.
    • The message assembly is saved under Other Resources in the application that contains the message flow that is being recorded.
    • You can now view a different message number in the same window and save that message too.
    • When you have finished viewing and saving the message assembly, select Close to close the window. You can now see the saved message assembly under the application in the Application Development view.
  8. Optional: Click Save All if you want to save the message assemblies from all the connections in the highlighted path in the Flow Exerciser.
    All the message assemblies for every invocation of the flow now appear in the Application Development View under the application that contains the message flow that was recorded.

    The image is described in the surrounding text.

    These message assemblies are also visible under Recorded Messages the next time that you select Send Message.

    These message assemblies can also be used as resources for integration tests for your message flow nodes.

  9. Optional: Edit a message assembly by completing the following steps:
    1. Double-click the saved message assembly under the Application Development view in the IBM App Connect Enterprise Toolkit.
    2. Select Open with > Message Assembly Editor from the menus.
      The message assembly opens in the Message Assembly Editor.
    3. Edit the values under the Name, Type, and Value columns.
    4. Save your changes.
    5. Edit the message flow to expect the updated values. For example, if your flow has a Compute node, update the ESQL. For more information, see Editors.
  10. If you save a recorded message assembly, you can send it as a message to a message flow, by completing the following steps:
    1. Click Send Message.
      • The saved, recorded message assembly is shown under Recorded Messages.
      • A read-only view of the contents of the recorded message assembly is shown under the Main tab.
      • If you need to change the message assembly, select it from the Application Development view to open it, then edit it in the Message Assembly Editor.
      • The input node is not saved with the message assembly, and you can select which input node to send it to. All input nodes that are in the message flow are listed in the Input Location field.
    2. Press Send.
      The image is described in the surrounding text.

    The message is sent and the path of the message is highlighted in blue in the flow editor, as shown in step 5.