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

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Generic and Dynamic API: MuleSoft
  • Releasing MuleSoft API
  • API-Led Example: MuleSoft
  • On-Demand-Schedulers With MuleSoft CloudHub APIs

Trending

  • Docker Model Runner: Streamlining AI Deployment for Developers
  • Contextual AI Integration for Agile Product Teams
  • Operational Principles, Architecture, Benefits, and Limitations of Artificial Intelligence Large Language Models
  • AI’s Role in Everyday Development
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Mulesoft Synchronous API With IBM MQ

Mulesoft Synchronous API With IBM MQ

The purpose of this article is to provide a concrete example of working with IBM MQ and export API synchronously.

By 
Gary Liu user avatar
Gary Liu
DZone Core CORE ·
Feb. 24, 21 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
8.5K Views

Join the DZone community and get the full member experience.

Join For Free

Introduction

The purpose of this article is to provide a concrete example of working with IBM MQ and export API synchronously. By nature, IBM MQ or other JMS Queue is asynchronous communication. The customers require the API to be synchronous. 

Also, in this case, the backend IBM MQ application is NOT JMS compliant. This creates a challenging situation for encoding messages and correlation ID.

Use Cases

As shown in the diagram below. The requirement is to expose an experienced API to customers. The REST API will provide data from the backend, which is IBM MQ Serius exposing MainFrame data.

REST API providing data from the backend graphic

  • Customers will invoke the API in synchronous mode
  • Response data should be in JSON format
  • Mulesoft API need to send message to IBM MQ using non-JMS compliance mode
  • Both correlation ID and payload must be encoded in EBCDIC format

Key Challenges

  • The backend implementation for messaging is not JMS compliant
  • JMS by nature is Asynchronous, but REST API is synchronous

Technical Solution

Given the requirement, we must use the Mulesoft IBM Connector. The current version is 1.6.3. The IBM MQ connector provides an operation namely Publish-Consume.

Encoding of EBCDIC in the term of connector attribute is CP1047 per IBM MQ document.

The Mulesoft flow takes the following form:

Mulesoft flow

The complete code can be found at GitHub here.

Connector Configuration

The IBM MQ connector configuration is standard. The only attention is the targetClient, which is NO_JMS_COMPLIANT

targetClient is NO_JMS_COMPLIANT

Global Element Properties


Publish-Consume Configuration

The configuration for the operation of Publish consume is shown below. Please note two things:

  • Request-Reply Pattern: CORRELATION_ID
  • Encoding for both publisher and consumer is set to CP1047

Correlation ID and Encoding examples

Encode Correlation ID

For simplicity's sake, I encoded the correlation ID using a JAVA class. This can be done using Dataweave. But I recommend using the JAVA class and eventually create a connector for reusability.

For the complete JAVA Code, please refer to my GitHub project.

GitHub Project Screenshot


A few notes for encoding correlation ID:

  1. It is encoded by CP1047
  2. Its format is ID: + 48 HEX Digits

Key Takeaways

  • Use trials and errors approach for this kind of integration, particularly if the backend implementation is done via 3rd party
  • The EBCDIC encoding is CP1047 in terms of Mulesoft configuration
  • Make sure to encode the correlation ID in the format of EBCDIC
API MuleSoft

Opinions expressed by DZone contributors are their own.

Related

  • Generic and Dynamic API: MuleSoft
  • Releasing MuleSoft API
  • API-Led Example: MuleSoft
  • On-Demand-Schedulers With MuleSoft CloudHub APIs

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!