We at AdroitLogic recently released a new integration product stack that consists of a completely redesigned version of our flagship product UltraESB-X, and a set of complimentary products to the develop and manage UltraESB-X based integration solutions with ease. Among those products, AdroitLogic UltraStudio is an Intellij IDEA based development environment to develop integration projects while AdroitLogic Integration Platform Server (IPS) is a multi-node container platform to deploy and manage UltraESB-X instances.
Throughout this post, we will be developing a simple Integration Flow using UltraStudio, validating for configurational correctness, testing for functional accuracy, and finally packaging and deploying it on an UltraESB-X cluster using IPS.
Prerequisites
As a prerequisite, you should have set up UltraStudio on your machine and also need to have access to an Adroitlogic IPS installation.
- If you do not have UltraStudio, please download it from here and follow the installation guide.
- Also you can download a single-node IPS installation from here and set it up following this quick-start guide.
Once you have both of these products up and running, let’s start developing.
Development
A simple Integration Flow
Before getting into development, let’s think about what is intended from the Integration Flow that we are going to develop. Our integration flow should receive an HTTP request and then check for the existence of a specific transport header (let’s say X_HELLO header). If it is present, the request should be sent to a particular backend server (let’s say Server 1) via HTTP, or else the request should be sent to a separate backend server (Server 2). In both cases, the response received from the backend servers should be sent back as the response for the original HTTP request.
Creating a new Project
First let’s create an Empty Ultra Project using UltraStudio. Open UltraStudio and navigate to Create New Project and then select Empty Ultra Project.
In the next window, provide a group ID, a version and a base package for the project. I’m going to use com.udith.sample as the group ID and base package name while using 1.0 as the version. Then from the connectors list, select HTTP NIO Connector and select Flow Control from the list of processors. After that provide a project name (I’m going to use header-router), a project location and finally click Finish to create the project.
If prompted to add the project as a Maven project, confirm it and wait for UltraStudio to download the dependencies for the project.
Developing the Integration Flow
Once all the Maven dependencies get resolved, let’s create a new integration flow. As a convention, any integration flow should be created in the src/main/conf directory or in one of its subdirectories. So right-click on the src/main/conf directory of the project, select New -> Integration Flow, provide a name and click OK.
Then double-click on the created file to open it and switch to the Design tab when it is opened in the editor. In this tab, you can find a palette on the left, that contains all the connectors and processing elements belonging to the packages we selected at the project creation phase (we selected HTTP NIO Connector and Flow Control). Using these components we can create our integration flow as follows, which contains an HTTP listener, a conditions evaluator and two HTTP senders with the following configurations.
HTTP Listener
This should listen to our intended port and service path to receive the HTTP requests. Currently it captures every HTTP request coming to a path ending with /router-proxy on port 8280.
Component ID : http-8280-listener
Http Port : 8280
Service path : .*/router-proxy
Conditions Evaluator
This should evaluate the existence of a transport header named X_HELLO.
Component ID : header-evaluator
Predicate Type : HEADER
Variable Name : X_HELLO
Variable Type : String
Predicate Function : EXISTS
HTTP Sender 1
This should send the message to backend server 1. Here we are going to use the Echo Service provided by the in-built Jetty server of UltraStudio over the port 9000.
Component ID : http-9000-sender
Destination Address Type : URL
Destination Host : localhost
Destination Port : 9000
Service path : /service/EchoService
HTTP Sender 2
This should send the message to backend server 2. Similar to sender 1, here also we are going to use another instance of the Echo Service provided by the in-built Jetty server of UltraStudio over the port 9001.
Component ID : http-9001-sender
Destination Address Type : URL
Destination Host : localhost
Destination Port : 9001
Service path : /service/EchoService
Verification
Validating the Flow
Now we are done with developing our integration flow. But before we test it, we should verify that we have done all the necessary configurations correctly. For that we can use the Flow Validator tool provided by UltraStudio that will validate the configurations of all the integration flows of the project and provide an interactive report. To access this tool, open the Flow Validation pane at the bottom, select the header-router module and click the Validate button. If all the configurations are correct, validation result should indicate Validation Passed.
Just to check this flow validator’s error scenario, let’s remove the connection from the Condition Evaluator to the first HTTP Egress Connector, and then rerun the flow validation. Now you will see 2 errors on the flow validation result, one related to the HTTP Ingress Connector and another related to the Conditions Evaluator. By double clicking on an error, you can easily find the connector/processor related to that.
Remember to reconnect the removed connection and make sure the flow validation is getting successful again. After that, open up the Terminal tab of UltraStudio and execute the command mvn clean install to build the project in order to verify that there are no compilation or build errors.
Testing
Testing the Flow
Since now we have a correctly configured flow, we should test its functionality. For that, first navigate to Run -> Edit Configurations and add an UltraESB Server run configuration.
Then click on the Run button to start an UltraESB server, starting our project as well as our integration flow successfully.
Now, before we send any requests to this UltraESB server, we should start our backend servers (remember that we defined echo service at localhost port 9000 and port 9001 as our backend servers). To start the echo service, open the Jetty Server pane of UltraStudio and start 2 servers on ports 9000 and 9001.
Then open the Ultra Studio Toolbox pane, add a new HTTP/S client and send a sample request to the URL http://localhost:8280/service/router-proxy.
For this request you should get a 200 OK response with port as 9001, which the 2nd server we have defined. Since we haven’t added the transport header X_HELLO to the request, it has been sent to the 2nd server by UltraESB as expected.
But rather than checking the port on the response, we can easily check out message path on the flow itself by clicking the Show Message Path button at the top of the flow design view, which will highlight the path of the latest message. Also you can view the message payload, transport headers, scope variables, etc at each stage by clicking on the Message Context button on each path segment.
Now let’s add the X_HELLO header to the request and see how the integration flow behaves. For that open the Config Panel of the HTTP client by clicking on the wrench icon at the top left corner. Then go to the Custom Headers tab, add a header named X_HELLO and resend the response. Then again click the Show Message Path button and you will observe that the message has been sent to the Server 1 as expected.
Since our integration flow has passed both test scenarios as expected, our work as a developer is done. Yes! we developed a complete integration flow without writing a single line of code. So let’s now upload the project to our Integration Platform Server.
Deployment & Management
Uploading to IPS
To upload our project to IPS, first we have to configure the IPS URL on UltraStudio settings. For this, navigate to Preferences/Settings -> Tools -> Ultra Studio, fill the IPS URL field and click Apply.
Then go to Tools -> Ultra Studio -> Upload to IPS, select the .xpr created by the Maven build (target/header-router-1.0.xpr in this case) as the project and provide the IPS user credentials (username admin, password admin) to upload the project. Once you click OK, the project will be uploaded to the IPS and ready to be deployed.
Finally you can go through the following screencast on how to create an UltraESB-X cluster on IPS and deploy our new project on that cluster.
On a separate note, if you require to deploy this project on a standalone UltraESB-X server, all you need to do is to copy the built .xpr file to the projects directory of that UltraESB-X server and restart it.