Invoking an App Connect Enterprise callable flow from App Connect Enterprise as a Service

In this scenario, one flow that is running in App Connect Enterprise as a Service invokes (calls) another flow that is running in App Connect Enterprise.

About this task

You might use this scenario if your callable flow completes some processing on premises that you want to share across multiple flows in the managed service. Each of those flows can call the on-premises callable flow. Or you might split processing between different environments to improve performance. The following instructions describe how to develop and deploy your callable flow, then create a flow that invokes the callable flow.
The diagram shows an invoking flow in App Connect Enterprise as a Service, and a callable flow in App Connect Enterprise. The CallableFlowInvoke node in the invoking flow uses a Switch server to call the CallableInput node of a callable flow.

Developing and deploying a callable flow in App Connect Enterprise

Procedure

To develop and deploy a callable flow on premises, complete the following steps. You create an integration server and deploy the application that contains your callable flow.

  1. In the IBM® App Connect Enterprise Toolkit on premises, create a message flow in an application by following these guidelines.
    1. Click File > New > Message flow.
    2. In Container, select an existing application to contain your flow, or click New to create an application.
      The Callable flow Invoke node in App Connect Enterprise as a Service calls the on-premises callable flow by referring to the application that contains the flow, and the endpoint name on the CallableInput node. Therefore, you must include your callable flow in an application.
      Note: Application and endpoint name pairs must be unique on a single integration server. You can have multiple callable flows that share the application and endpoint names, but they must be in different integration servers.
    3. Enter a name for the message flow, then click Finish.
    4. Expand the Callable flow section of the Palette, and drag a CallableInput node and a CallableReply node onto the canvas.
    5. Construct the rest of your message flow in the usual way.

      For example, add nodes between the Input and Reply nodes that transform the data that you receive from the invoking flow. For more information, see Designing a message flow in the App Connect Enterprise documentation.

    6. To configure the CallableInput node, enter a name in Endpoint Name.
      The Callable flow Invoke node in App Connect Enterprise as a Service uses this endpoint name to call the on-premises flow.
  2. Add the application that contains your callable flow to a broker archive (BAR) file.
    1. In the IBM App Connect Enterprise Toolkit, click File > New > BAR file.
    2. Enter a name for the BAR file, such as callableflow, then click Finish.
      A BAR file is created with a .bar extension.
    3. On the Prepare tab of the BAR file, select the application that contains your callable flow and any shared libraries, if appropriate.
      If your flow uses policies, static libraries, or any other message flows or resources, you can also add them on this tab. For more information, see Adding resources to a BAR file in the App Connect Enterprise documentation.
    4. Click Build and Save.
      A message is shown to say that the operation was completed successfully and the BAR file is listed in the BARs section of the Application Development view.
  3. Create an integration server where you can deploy your callable flow BAR file.
    1. Open the App Connect Enterprise command environment.

      Windows platformFor example, on Windows, open the Start menu, click IBM App Connect Enterprise Console x.x.x.x.

      Linux platformOn Linux®, locate and source the mqsiprofile script in the directory where you installed App Connect Enterprise.
      source install_dir/server/bin/mqsiprofile
    2. Run the mqsicreateworkdir command and specify the full path to the directory that you want to create.
      This command creates a work directory for your integration server that contains a default configuration file called server.conf.yaml. This YAML file contains the default settings for your new integration server. (For more information, see mqsicreateworkdir command in the App Connect Enterprise documentation.)
      For example, on Windows, run the following command.
      mqsicreateworkdir c:\mycallableflows
  4. Deploy the BAR file that contains your callable flow to the new integration server.
    1. In the App Connect Enterprise console, run the mqsibar command. Specify the BAR file to deploy and the integration server to deploy it to, as shown in the following example.
      mqsibar -a C:\Users\Admin\IBM\ACET12\workspace\BARfiles\callableflow.bar -w /mycallableflows 
    For more information, see mqsibar command in the App Connect Enterprise documentation.

Results

Your callable flow is now deployed and ready to be invoked.

What to do next

Configure secure connectivity between the two environments so that your callable flows can communicate with each other.

Configuring secure connectivity between App Connect Enterprise as a Service and App Connect Enterprise

Procedure

To configure connectivity between an invoking flow in App Connect Enterprise as a Service and a callable flow in an on-premises integration server, complete the following steps. You configure connectivity by downloading a configuration file from App Connect Enterprise as a Service and applying it to your on-premises integration server.

  1. In the App Connect Enterprise as a Service navigation pane, expand Connect Icon that represents the Connect category, then click Private networks.
  2. On the Private network connections page, click Create.
    A private network connection is created.
  3. Open the menu Icon that represents the menu on a flow tile next to the new private network connection, then click View setup instructions.
  4. On the Callable flows tab, expand Download the secure agent configuration, then click Download the configuration to download the secure agent configuration to the computer where you installed App Connect Enterprise.
    The downloaded configuration file is called switchclient.json. Check that it contains the line "callableFlows": "enabled". (You don't need to configure endpoints in the switchclient.json file if you're using it for callable flows.)
    Tip: If you're using an existing private network connection, make sure that the callableFlows property in the configuration file is plural. In configuration files for older private network connections, the property might be in the singular (callableFlow), so you need to update it.
  5. Move the switchclient.json file into the config/switch folder of the work directory for the integration server where your callable flow is deployed. (If the switch directory doesn’t exist, you need to create it first.)
    config/switch/switchclient.json
    
  6. Start your integration server.

    To start your integration server, run the IntegrationServer command in an App Connect Enterprise command environment, as shown in the following example. (For more information, see IntegrationServer command in the App Connect Enterprise documentation.)

    For example, on Windows:
    IntegrationServer --work-dir c:\mycallableflows
    Or on Linux:
    IntegrationServer -w /home/username/mycallableflows
    When the integration server starts, it sends data to the Switch server about the flows that are deployed to it.
  7. Check the App Connect Enterprise console for messages that indicate that the private network connection connected successfully to the Switch server, as shown in the following example.
    BIP6450I: The connection agent for remote callable flows has established a connection to the Switch server with URL 'wss://default-switch-server-switch-....'.
    BIP2206I: The integration server component 'switchclient' has been started.

What to do next

Create an invoking flow in App Connect Enterprise as a Service.

Creating an invoking flow in App Connect Enterprise as a Service

Procedure

To create a flow in App Connect Enterprise as a Service that can invoke a callable flow on premises, complete the following steps.

  1. On the App Connect Designer home page, click Create an event-driven flow or on the Designer dashboard, click New then Event-driven flow.
  2. Enter a name for your flow.
  3. Choose an event to trigger your flow, either from the Applications tab or from the Toolbox.
  4. Click the plus (+) icon after the event, then on the Applications & APIs tab, expand Callable flow and click Invoke.
  5. In Application, select the App Connect Enterprise application that contains the callable flow.

    The Application field is populated automatically with a list of applications that are deployed to the integration server that you configured with a private network connection. This information is sent to the Switch server when the integration server is started.

  6. In Endpoint, select the endpoint name of the callable flow on premises.

    The Endpoint field is populated automatically with a list of endpoint names of the callable flows in the selected application. The Endpoint name is a property on the CallableInput node of your on-premises callable flow. Your invoking flow uses this property to identify and call the flow.

  7. Use the LocalEnvironment.Variables and Message.JSON.Data fields to specify properties and data to send to the on-premises callable flow.
    When the invoking flow is triggered, the Callable flow Invoke node calls the CallableInput node of the message flow that is running in App Connect Enterprise. You can use the LocalEnvironment.Variables and Message.JSON.Data fields to provide data that can be used by nodes in the callable flow. You can enter your own values or write data from the trigger event to the local environment and message trees that are sent to the callable flow. The following example shows that two properties, FileName and Directory, are configured as local environment variables. These properties specify the directory and file name for the on-premises callable flow to write to. The message tree that is sent to the on-premises callable flow includes data that is mapped from the event that triggered the flow in App Connect Enterprise as a Service.
    Screenshot shows two LocalEnvironment.Variables properties: FileName is set to the name of a .txt file, and Directory is set to a directory on the C: drive. Three properties are configured for Message.JSON.Data: FirstName, LastName, and Email properties are mapped to the First name, Last name, and Email fields from the event that triggered the flow.
    • To define a property, click Add property, enter a name for the property, and select the appropriate data type for the value.
    • To add values for the properties, click Edit mappings, then type in a value or select a field from a previous node in the flow.
    • Alternatively, to specify a value in JSON format, click Map to object, then enter a JSON expression. The following example shows a simple JSON object message with one name-value pair:
      {"Message":"Hello World"}

      To add fields to your JSON expression that map data from previous nodes in the flow, click Insert a mapping The icon that represents Insert a mapping..

  8. Add more actions or toolbox nodes to your flow after the Callable flow Invoke node to process the data that the callable flow returns.
    You can use the data that the callable flow returns in other applications by mapping the data. For more information, see Configuring actions.

What to do next

Deploy the invoking flow.

Deploying an invoking flow

Procedure

Deploy the flow that contains the Callable flow Invoke node by following the instructions for your plan and your preferred method.
Deploying the flow on the flow runs plan
  1. Go to the Manage Icon that represents the Manage page tab and click Deploy.
  2. Select the flow that contains the Invoke node, then click Next.
  3. Check the summary of the flow, then click Deploy.

    A tile is added to the Manage page for your flow and is marked as "Inactive".

  4. Open the tile menu Icon that represents the menu on a flow tile and click Activate.

    The status on the tile changes to "Active" and the deployed flow is ready to be triggered.

Deploying the flow from the Dashboard instance on the VPC hours plan
  1. Export the flow from your Designer instance as a BAR file.

    (On the Designer dashboard Icon that represents the Designer dashboard, open the menu on the flow's tile, click Export, and select Runtime flow asset (BAR).)

  2. Switch to your Dashboard instance and click Deploy integrations.
  3. On the Size tab, select the appropriate size of integration runtime for your flow, then click Next.
  4. On the Integrations tab, upload the BAR file that contains your invoking flow, then click Next.
  5. On the Configuration tab, select a private network connection configuration, then click Next.
  6. Enter a name for the integration runtime, select the version, and set any other properties that are appropriate. For more information, see Deploying integrations on the VPC plan.
  7. Click Create.

    The integration runtime is initially shown in pending status. Refresh the browser to update the status.

Deploying the flow from the Manage page on the VPC hours plan
  1. On the Manage page, go to the Integrations tab and click Deploy integration.
  2. Select the callable flow that contains the Invoke node, then click Next.
  3. Select an existing runtime, then click Next. Alternatively, create a runtime by clicking Create runtime. For more information, see Creating a runtime.
  4. On the Add configurations page, select a private network connection configuration, then click Next. You can select the default private network connection configuration default-switch-server-privatenetworkagent or you can select one that you created yourself.
  5. Check the summary of what you're deploying, then click Deploy.

    A message indicates that the integration is being deployed. Refresh the browser to update the status. When the integration is deployed, a tile is shown on the Integrations tab of the Manage page and the status is Active. The invoking flow is ready to be triggered.

Results

When the integration runtime is ready, the invoking flow is deployed and is ready to be triggered. When the invoking flow is triggered, the Callable flow Invoke node invokes the Callable Input node of the callable flow on premises. The callable flow runs on premises and the Callable flow Reply node returns data to the Callable flow Invoke node in the cloud. Subsequent nodes in the flow can then use this returned data.

Your callable flows are listed on the Callable flows page (in the Connect category Icon that represents the Connect category of the navigation pane). The table lists the applications and endpoints for the callable flows that you're connected to. You can also see whether the callable flow is provided by App Connect or by an on-premises integration server.