Developing asynchronously callable message flows

Create a calling message flow that contains a CallableFlowAsyncInvoke node. Create a callable message flow that contains CallableInput and CallableReply nodes. Create a response message flow that contains a CallableFlowAsyncResponse node.

Before you begin

Read the concept information in Callable message flows.

About this task

This topic explains how to split processing between asynchronously callable message flows, by using the CallableFlowAsyncInvoke and CallableFlowAsyncResponse nodes. You can also choose to share data between the flows that contain these nodes (the calling flow and the response flow) by storing and retrieving data in the UserContext folder in the Environment. For information about sharing data between the calling flow and the response flow, see Sharing data between a calling flow and a response flow.

Procedure

The following steps describe how to create a calling flow, a callable flow, and a response flow that can send information to each other.

  1. In the IBM Integration Toolkit, create the calling message flow, which must include a CallableFlowAsyncInvoke node.

    The CallableFlowAsyncInvoke node parses the incoming message in full so that it is in a suitable format to send to the CallableInput node. Therefore, you should validate the message before it reaches the CallableFlowAsyncInvoke node. If the message fails validation at this point, it can be rolled back.

  2. In a different application, create a callable message flow, which must begin with a CallableInput node, and contain a CallableReply node.

    A CallableFlowAsyncInvoke node calls a callable flow by referring to the endpoint name on the CallableInput node, and the application that contains the callable flow. Therefore, you must include all callable flows in applications.

  3. On the CallableInput node of the callable flow, use the Endpoint Name property to provide a name for the callable flow.

    Application and endpoint name pairs must be unique on a single integration server. You can have multiple callable flows that share the same application and endpoint names, but they must be in different integration servers. In this case, the Switch server acts as a load balancer.

  4. On the CallableFlowAsyncInvoke node of the calling flow, set the following properties:
    Table 1. CallableFlowAsyncInvoke node properties
    Property Value
    Target Application Set this property to the name of the application that contains the callable flow.
    Target Endpoint Name Enter the name of the Endpoint Name property of the CallableInput node. This name is case sensitive. The Target Endpoint Name must match the Endpoint Name of the CallableInput node exactly.
    Request timeout (sec) Set the time within which the callable flow must be called, in seconds. If the callable flow is not called within the specified time, an error message is issued.
    Call Preference
    • If your main and callable flows are in the same integration server, set this property to Prefer local calls.
    • If your flows are split between different integration servers, between IBM Integration Bus and IBM App Connect on IBM Cloud, set this property to Remote calls only.
  5. In a different application, or in the same application that was used in step 1, create a response message flow that starts with a CallableFlowAsyncResponse node.
  6. Set the Unique identifier property of the CallableFlowAsyncResponse node to match the value set in the CallableFlowAsyncInvoke node that was created in step 1.
    You now have three separate message flows: a calling flow, a callable flow, and a response flow:
    The diagram shows that a CallableFlowAsyncInvoke node in the main message flow calls a remote flow.  The remote flow completes some processing, then responds to a separate response flow.
  7. Package the applications that contain your calling and response message flows into a BAR file, and package the called message flow into a separate BAR file.
  8. Deploy the BAR files to the appropriate integration servers.

    If you are splitting processing between IBM Integration Bus and IBM App Connect on IBM Cloud, deploy one BAR file on premises and upload the other to the cloud. For more information about deploying BAR files to the cloud, see Deploying integration solutions to a production environment.

Results

When you pass a message into the main message flow, the CallableFlowAsyncInvoke node sends the contents of the message body and local environment folders to the CallableInput node of the callable flow and then completes. When the callable flow completes processing, the CallableReply node sends the message body and local environment folder data to the CallableFlowAsyncResponse node in the separate response flow.

What to do next

If your callable flows are in different integration servers, you need to create a Switch server (which routes data) and connectivity agents to allow the flows to communicate securely. For more information, see Preparing the environment for callable flows.