Chapter 10. Advanced Orchestration with Branching and Asynchronous Flows
In the previous chapters we built integrations that primarily had one source (trigger) and one target (invoke) service connection. Within some of our integrations we extended this by introducing enrichment services and chaining integrations using the publish/subscribe pattern. This kind of service could be called after the message was received by the source connection or after receiving the response from the target connection, just before sending the response back to the caller of the source connection. Between these service calls we transformed the message so that the message was in the correct form to be understood by the receiver of the message.
In the previous chapters you might have noticed that we were restricted in making different decisions based on the message content and the limited possibility of chaining service calls.
In this chapter we want to introduce you to orchestration. In Chapter 1, Introducing the...
Before we get started we need to have all connections ready for use in our orchestration. As we mentioned we are going to reuse some already existing connections, but we also have some new connections that we are going to use. The new connections include Trello
and an updated version of the FlightAirlineREST
API (used in Chapter 2, Integrating Our First Two Applications) which we need to set up.
For Trello, we are using another OOTB Cloud adapter. With this cloud adapter it is possible to, for example, retrieve a list of all tasks, update a task list, and create new tasks. Depending on the operation you choose you get a different response. Within the orchestration we are free to use it elsewhere in the process. For the Flight
API, we are reusing the already existing connection, but we will update the API definition in apiary to include a new resource to have airline details include social preferences.
For this orchestration, we are going to use Trello. This is a collaboration tool that organizes projects and tasks into boards and lists. It can tell what is being worked on, who is working on what, and where something is in a process. The Trello API with the adapter offers operations to let you search, read, create, and update the board, task content, and metadata. In our case we are creating a new task for ground personnel when a flight has arrived at the gate. To complete our setup of Trello, we need to execute the following steps:
Get access to a Trello account.
Create a new Board and Tasks list.
Obtain list identification.
Obtain API credentials.
Step 1 – Getting access to a Trello account
For this integration, we can use any Trello account you can get access to. If you do not have an account yet, or want to have an extra account for testing purposes, go to trello.com/signup and follow the instructions.
Step 2 – Creating a new board and tasks list
To allow ICS to interact...
Updating the apiary Flight API
For this orchestration, we are reusing the Flight API built using apiary in Chapter 2,Integrating Our First Two Applications. In the current state the Flight API only has one resource, providing a list of all airlines and the details of each airline in the list. We are going to add two more resources to get a specific airline based on a flight airline code (two characters).
To update the Flight API in apiary we need to execute these steps:
Log in into apiary and switch to the Flight API endpoint.
Change the source of the API Blueprint.
Step 1 – Log in to apiary and switch the API
To allow ICS to retrieve specific airline information we need to change the blueprint of the API. Go to login.apiary.io, and log in with your credentials. If you have only one API on your account you are redirected to the ICS Flights API; otherwise you can click on the name of the current selected API and switch to the ICS Flights API as shown in the following screenshot:
Defining the necessary connections
In this chapter, we will reuse most of the inbound and outbound connections from previous chapters. The only connection that we need to create is the one to the Trello API. You should have created all the other connections in past chapters, but we will need to update one to also work as an invoke connection.
In ICS, navigate to the connections page and create a connection using the Trello adapter. Create a connection to Trello with the following details:
After creation, configure the connection with the following details: