flows

Developing an Integration Flow

Version: 17.07

First create an empty project as described in Creating a project section. When creating an empty project, select the HTTP NIO module from the connector list. Further, from the processors list select Flow Control, Message Transformation and Message Validation modules. After creating the project, add it as a Maven project

Project Structure

This empty project is a basic maven project with a few new items. Let’s see what are these new items in the project

Project.xpml File

This file contains the information about your project such as name, version and description.

<x:project id="mySampleProject" name="mySampleProject"
version="1.0-SNAPSHOT"xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="http://www.adroitlogic.org/x/x-project"  xsi:schemaLocation="http://www.adroitlogic.org/x/x-project http://schemas.adroitlogic.org/x/x-project-1.0.0.xsdhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
    <x:description>
        A sample project that demonstrates the projects concept
    </x:description>

    <x:flows>
           <x:flow id="sampleFlow" file="helloWorldFlow.xcml"/>
    </x:flows>

    <x:resources>
    </x:resources>
</x:project>

Further, within the flows tag, all the integration flows in your project where file path is specified relative to the conf directory will be added. When you run the project, only the integration flows specified in this section will be deployed. Apart from that within the resources tag, you can specify re-usable complex spring beans which in return used by components in your integration flow.

Conf Directory

This is where all your integration flows must reside. It is not recommended to create integration flows anywhere else in the project. Although, you can create sub-directories within conf directory to organize your flows.

Apart from these main two items, there are few files in the test/resources directory and for now you do not need to worry about those.

Now let’s create our first integration flow. Keep in mind that all the integration flows which are created must reside within the conf directory. First right click on the conf directory and from the context menu, select Integration Flow. After that specify helloWorldFlow as the flow name and click on OK button.

Now you can see that there is a new file added to the conf directory and double click on it to open it in the editor view.

Main Components of the Editor View

studio ide overview
Figure 1: Design View

1 . Main Toolbar

The main toolbar (Figure 1:1) contains all the important functionalities which affect the design view. Below list contains brief description of each button and the respective functionality of that button (Figure 1).

  1. Toggle the component pallet’s visibility

  2. Toggle the property pane’s visibility Toggle the visibility of grids on the design canvas

  3. Refresh the editor view Highlight the message execution path in the integration flow Clear the highlighted message execution path

  4. Zoom in the design pane

  5. Zoom out the design pane

  6. Reset the Zoom view of design pane

2 . Component Pallet

This pallet (Figure 1:2) contains all the components required to create an integration flow. There are ingress/egress connectors, processors, and so on. If you want to refresh your

3 . Properties Pane

This pane (Figure 1:3) contains all the properties which can be specified by the user for a particular component. i.e. for a given component to function properly, user has to manually specify some properties and these properties varies from one component to another. Apart from that, this pane contains a Documentation tabs which provides the basic documentation of the specific component.

4 . Design Canvas

This is where you can create your integration flow. You can drag and drop component from the component pallet in to the design pane and keep on creating your flow (Figure 1:4).

5 . Component

sample component
Figure 2: Sample Component

Each component is unique and designed to execute a specific logic. As shown in figure 2 the circles surrounding the component icon are called ports. Mainly there are four port types.

  • In-Port (grey color circle) - This is where messages are given as input to the component. A component can have only one in-port and specific type of components such as ingress connectors have zero in-ports

  • Out-Port (green color circle) - This is where the output message is emitted from the component. There can be zero or more outports for a particular component.

  • Side-ports (blue color circle) - These ports are used to connect other components as parameters for a particular component. There can be zero or more side ports for a particular component.

  • Exception-Port (red color circle) - This is a sub set of out ports and an output is emitted from the component through this port if an exception or an error occurs while executing the component’s logic, so that the user can gracefully handle it.

Creating the Hello World Flow

Now let us start adding component to the design pane and create our flow. In this sample flow, first we will create a flow where the UltraESB will accept a message through HTTP protocol and send it to a backend service, and return the response received from the back end service to the original client.

Adding a component takes just two steps: . Drag and drop the component into the desired location on the design canvas. . In the Specify the Component ID pop-up, enter a unique identifier (name) for the new component, and click OK.

For our basic flow we need two components. First one is HTTP NIO Listener (under connectors/ingress category) and the other one is the HTTP NIO Sender ( under connectors/egress).

Next we need to connect these two component as shown in figure 3. We have connected the out port of the HTTP NIO Listener with the in-port of the HTTP NIO sender and the out-port of the HTTP NIO sender with the in-port of the HTTP NIO Listener.

basic flow
Figure 3: Connected Integration Flow

Now let’s run the flow validator and see if our flow is correct. In the bottom tab bar, there is a tab named flow Validation and within that tab select the module you want to validate and click on the start button.

flowvalidator
Figure 4: Flow Validation Result

As you can see from the result in figure 4, we have few errors in our flow. Double clicking on the error will show you the erroneous component.

These errors indicates missing configuration. Hence we need to specify few properties for these components in-order for those to work properly.

If you hover over a component, you can see the blue cog icon and, by clicking on that, you can open the property pane of that component. You can open the property pane by double clicking on the component as well.

For the HTTP NIO Listener, mainly there are two properties we need to specify

http listener prop
Figure 5: Property configuration for HTTP NIO Listener
  • Http Port - The port we want our http listener to start listening for incoming request. For this example let’s specify 8280.

  • Service Path - The resource path where we want to filter out the incoming requests. Specify /service/echo-proxy for that.

After specifying those properties, click on the save button. Now we have configured our HTTP listener to listen at /service/echo-proxy on port 8280 for incoming requests.

Similarly, we need to configure our HTTP NIO sender as well. For the sender, all you have to specify is the address of the backend system. for this example let’s specify http://localhost:9000/service/EchoService as shown in figure 6.

http sender prop
Figure 6: Property configuration for HTTP NIO Sender

We have completed the configuring our flow. Now you might be wondering how to start a backend service on port 9000.

Fear not, we provide a very basic jetty server for testing within the Ultra Studio. As shown in figure 7 click on the start button to start a Jetty server on port 9000.

jetty panel
Figure 7: Embedded Jetty Server Panel

Running the Project with Flows

In-order to run the project, first we need to build the project. Open the terminal tab as shown in figure 8 and execute the command mvn clean install

terminal tab
Figure 8: Terminal Tab

After successfully building the project, you will see an output as shown below on in the terminal.

[INFO] ---------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ---------------------------------------------
[INFO] Total time: 1.952 s
[INFO] Finished at: 2016-10-07T10:47:50+05:30
[INFO] Final Memory: 28M/402M
[INFO] ---------------------------------------------
When building the project, maven will fetch the dependencies from the remote repository. Although if those dependencies are already cached in the M2 home, maven will use the dependencies in the local cache instead of downloading them from the remote repository

Now we need to create the run configuration. First click on Run → Edit Configurations… menu item and open the Run/Debug Configuration window. Next from the context menu shown after clicking on the + icon select UltraESB server, and specify a name for your configuration (figure 9) and click on OK button.

run configuration
Figure 9: Run/Debug Configuration

After that click on the run button on toolbar (figure 10)

run button
Figure 10: Run button on toolbar

you will see below output on run tab which signals that the UltraESB has started successfully

INFO XContainer AdroitLogic UltraStudio UltraESB-X server started successfully in 7 seconds and 407 milliseconds

Sending a Sample Message

In order to send a sample message you can use the http client we have integrated with the Ultra Studio. As shown in figure 11, create a new HTTP client (figure 11:1), select payload 1 (figure 11:2) and send it (figure 11:3) after changing the URL into http://localhost:8280/service/echo-proxy

http panel
Figure 11: HTTP Client Panel

Now in the response window, you can see the response, and the response payload is as same as the request payload since we sent the message to an echo server.

Debugging the Message Execution Path

One other cool feature of Ultra Studio is that you can view the message execution path in the flow you have created. Click on the show message path icon on main toolbar and it will highlight the execution path as shown in figure 12.

debug message
Figure 12: Highlighted message execution path

This feature comes in handy when there is a complex message flow and you want to check which branches of the flow got executed while processing the message. Further, if you click on a the message icon for a particular link, you can see the full message context which passed through that particular link as shown in figure 13.

message view
Figure 13: Message Context View
In this topic
In this topic
Contact Us