Migrating Airline Flight Offer Service in MuleSoft to Kumologica

Kumologica
5 min readMar 17, 2024

In this article, we are going to explore the migration process of an airline flight offer API service from the MuleSoft Anypoint platform to Kumologica, which can operate as a serverless service on AWS Lambda.

Kumologica facilitates rapid development and deployment of serverless services through a low-code approach. For those who are new to Kumologica,For those who are new to Kumologica I would recommend to go through our articles and youtube videos to get an insight.

Training & Certification
For a limited time, Kumologica offers free online certification
for developers on https://training.kumologica.com/

What makes Kumologica the preferred choice?

The service is currently developed and running on the MuleSoft Anypoint platform. The service we are considering migrating is developed using Anypoint Studio, a low-code tool offered by MuleSoft. The deployable generated by the studio is a Java-based binary that can be deployed on the Anypoint platform or a machine hosting Mule runtime, making these services inherently server-full. When we consider moving to the serverless world in AWS, we need to ensure that the binary is well-supported on AWS Lambda. We also need to consider not losing the benefits of low coding, which provide efficiency in service development and maintenance. Considering both of these points, Kumologica is currently the only platform offering a low-code studio for service development that can be deployed on any serverless infrastructure like AWS Lambda, Azure Function, or Google Function with zero code changes.

Airline Flight Offer Service

Flight offer service is an API which is exposed by the enterprise for its web application to consume. The users of web application will be checking for the available flights and its price offer by providing the date of travel, origin and destination.

sequence of operation

The service uses Amadeus API for getting the available flight offers. The above diagram shows the sequence of operations carried out by the integration layer in order to deliver the final response to the web application.

Implementation

Now, let’s delve deep into the implementation of the service built on MuleSoft initially and later on, into the similar implementation on Kumologica.

MuleSoft build

The main flow consists of an HTTP listener connector which accepts the request and pass to the flow . The main flow orchestrates the call to Amadeus API to fetch the token and to use the token to invoke and fetch the flight offers using the flight offers resource endpoint.

main flow

The flow initially logs the incoming request. The values are extracted from the request payload using Extract From Request dataweave.

%dw 1.0
%output application/java
---
{
"origin" : payload.originLocationCode,
"destination" : payload.destinationLocationCode,
"traveldate" : payload.traveldate,
"traveltime" : payload.traveltime
}

Next the flow invokes Get Token subflow which fetches the API token from Amadeus.

Get Token subflow

In order to get the token Amadeus API is invoked with client id and client secret with client_credential grant type.

%dw 2.0
%output application/java
---
{
client_id: '<<client id>>',
client_secret: '<<client secret>>',
grant_type: 'client_credentials'
}

once the token is fetched the main flow invokes Get Flight Offer Subflow to invoke Amadeus API to get the flight offers.

Get Flight Offers Subflow

Finally the main flow does the transformation to respond with the right data in its appropriate format. Format Response dataweave does this part.

%dw 1.0
%output application/json
---

{
"itenraries" : payload.data,
"price" : payload.data.price

}

Kumologica build

The main flow consists Event Listener node with source as AWS and source API gateway which accepts the request and pass to the flow . Exactly like MuleSoft the main flow orchestrates the call to Amadeus API to fetch the token and to use the token to invoke and fetch the flight offers using the flight offers resource endpoint.

Main flow

Similar to MuleSoft after logging the request we extract the date, origin and destination using JSONata expression in Datamapper node which is very similar to that of MuleSoft Dataweave.

{
"origin" : msg.payload.originLocationCode,
"destination" : msg.payload.destinationLocationCode,
"traveldate" : msg.payload.traveldate,
"traveltime" : msg.payload.traveltime
}

Next the flow invokes Get Token subflow which fetches the API token from Amadeus.

Get Token Subflow

In order to get the token Amadeus API is invoked with client id and client secret with client_credential grant type. This is configured in token request datamapper.

{
"client_id" : '<<client id>>',
"client_secret" : '<<client secret>>',
"grant_type" : 'client_credentials'
}

once the token is fetched the main flow invokes Get Flight Offer Subflow to invoke Amadeus API to get the flight offers.

Get Flight Offers Subflow

Finally the main flow does the transformation to respond with the right data in its appropriate format. Format Response datamapper does this part.

 {
"itenraries" : msg.payload.data,
"price" : msg.payload.data.price
}

Conclusion

Based on the build carried out on Kumologica, we could see that the implementation has very minimal differences compared to the MuleSoft flow. Even the DataWeave expressions have a very close relation to JSONata expressions, making it easy to migrate the flow from MuleSoft. Our next article will demonstrate how the service is deployed on AWS Lambda and the differences between Anypoint platform deployment and Lambda deployment

Would recomment to check out our earlier article on MuleSoft migrations.

Remember Kumologica is totally free to download and use. Go ahead and give it a try, we would love to hear your feedback

--

--

Kumologica

Kumologica is the first low-code development solution that makes your integration services run on serverless compute regardless the cloud provider.