DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Setting Up CORS and Integration on AWS API Gateway Using CloudFormation
  • Building a Scalable ML Pipeline and API in AWS
  • Serverless NLP: Implementing Sentiment Analysis Using Serverless Technologies
  • Unlock AI Power: Generate JSON With GPT-4 and Node.js for Ultimate App Integration

Trending

  • GitHub Copilot's New AI Coding Agent Saves Developers Time – And Requires Their Oversight
  • The Future of Java and AI: Coding in 2025
  • Tired of Spring Overhead? Try Dropwizard for Your Next Java Microservice
  • Monolith: The Good, The Bad and The Ugly
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Migrating MuleSoft System API to AWS Lambda (Part 1)

Migrating MuleSoft System API to AWS Lambda (Part 1)

In this article, we will be discussing how to migrate a System API running in MuleSoft to AWS Lambda in a quick and efficient manner with the least effort.

By 
Pranav K user avatar
Pranav K
DZone Core CORE ·
Nov. 06, 23 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
6.2K Views

Join the DZone community and get the full member experience.

Join For Free

In this article, we will be discussing how to migrate a System API running in MuleSoft to AWS Lambda in a quick and efficient manner with the least effort. To start, let's understand what system API is in MuleSoft. 

What Is System API?

System APIs provide access to data stored in an organization's central systems of record. They can extract information from essential systems such as ERP, customer, and billing databases, as well as proprietary data repositories. 

MuleSoft API Flow To Be Migrated

The MuleSoft system API flow has contact details to create and fetch operations from the MSSQL database. 

flowIn the above flow, the resource exposed by the API is:

  • :System API flow /contact.
  • To create contact : [POST] /contact 
  • To fetch contact by ID: [GET] /contact/id

When creating the contact, the following JSON payload is passed as input.

JSON
 
{ 
  "firstname" : "Tom",
  "lastname" : "Harris",
  "Depname" : "Finance",
  "empId" : "38993",
  "contact_info": {
    "contact_email" : "tom@abccorp.com",
    "contact_workphone" : "+04-993992909",
    "contact_mobile" : "",
    "contact_site" : ""
  }
}


The response for this API will be the JSON given below.

JSON
 
{
  "contact_firstname" : "",
  "contact_id" : "<<New Id generated by system>>"
}


Similarly, when fetching the contact details by ID, the following will be the JSON response.

JSON
 
{ 
  "empId" : "38993",
  "contactId" : "5555",
  "contact_info": {
    "contact_email" : "tom@abccorp.com",
    "contact_workphone" : "+04-993992909",
    "contact_mobile" : "",
    "contact_site" : ""
  }
}


Migration Journey

We are migrating the above MuleSoft flow to serverless compute of AWS, which is AWS Lambda. The flow implementation will be developed using Kumologica and will be running on the NodeJS runtime of Lambda. 

The following are key areas considered when migrating the flow.

API Kit Router: The API kit router of MuleSoft will route the API flow to the appropriate path of create or fetch operation. We will be using EventListener node in Kumologica for this purpose.

Dataweave: The dataweave will transform the incoming put JSON to the canonical payload expected inside the flow before sending the database. We will be using datamapper node in Kumologica to replace it.

DBConnector: MuleSoft flow uses a database connector to connect with the MSSQL database. In Kumologica, we will be using an MSSQL node for this purpose.

Security: MuleSoft API is secured via API gateway using API key-based security. In AWS, this will be done via AWS API Gateway and API key authorizer.

Building the Flow in Kumologica

Open the Kumologica developer studio using the command kl open

Plain Text
 
If you are not familiar with Kumologica designer you may follow the following steps to 
install the designer.

npm install @kumologica/sdk

Ensure your are having node version >= 16.14.0 and npm version 8.3.1


On the canvas, drag and drop the EventListener node and set the following configuration.

Plain Text
 
For create contact:

Provider : AWS
Event Source : Amazon API gateway
Verb : POST
URL : /contact

For get contact by Id:

Provider : AWS
Event Source : Amazon API gateway
Verb : GET
URL : /contact/:id


Wire the EventListener node to datamapper node and provide the following mapping.

JSON
 
{ 
  "db_fname" : msg.payload.firstname,
  "db_lname" : msg.payload.lastname,
  "db_dep" : msg.payload.Depname,
  "db_empid" : msg.payload.empId,
  "info": {
    "db_cemail" : msg.payload.contact_email,
    "db_cworkphone" : msg.payload.contact_workphone,
    "db_cmobile" :  msg.payload.contact_mobile,
    "db_csite" : msg.payload.contact_site
  }
}


Now wire the datamapper node to the MSSQL connector. 

Plain Text
 
For create contact:
INSERT into CONTACT C_fname, C_lname, C_dep, C_empid, C_email, C_workphone, C_mobile,C_site 
VALUES msg.payload.db_fname, msg.payload.db_lname, msg.payload.db_dep, msg.payload.db_empid, msg.payload.db_cemail, msg.payload.db_cworkphone, msg.payload.db_cmobile, msg.payload.db_csite

For get contact by id:

SELECT * FROM CONTACT WHERE C_id = msg.payload.id


The final Kumologica flow will look as follows.

Kumologica flow

Kumologica flow

We will be discussing the testing and production deployment mechanism of this flow in detail in our next article.

API AWS AWS Lambda Database JSON MuleSoft Integration

Opinions expressed by DZone contributors are their own.

Related

  • Setting Up CORS and Integration on AWS API Gateway Using CloudFormation
  • Building a Scalable ML Pipeline and API in AWS
  • Serverless NLP: Implementing Sentiment Analysis Using Serverless Technologies
  • Unlock AI Power: Generate JSON With GPT-4 and Node.js for Ultimate App Integration

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!