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
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
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
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Anypoint MQ on CloudHub: Part 2

Anypoint MQ on CloudHub: Part 2

If you are working and designing with Anypoint MQ, this tutorial explores message settings and their uses, plus Async implementation.

Ravi Mishra user avatar by
Ravi Mishra
·
May. 18, 17 · Tutorial
Like (4)
Save
Tweet
Share
6.13K Views

Join the DZone community and get the full member experience.

Join For Free

My last article on MQ got a good response. As already decided, we will conclude the MQ details in this article. So, let us start on available features of Anypoint MQ.

I have provided many settings and configurations in the previous article. Here we will start with other settings and their usage. Now you can click on the queue name which you have already created and configured.

Message Sender 

The Anypoint platform provides the opportunity to send the message to the queue directly. It results in proper checks about the working of the queue. For example, I can check what messages I have put in the queue and what is the format related to it. 

The below image can provide you the type of message Anypoint MQ supports natively. JSON, Text(string), and XML are currently supported. These types are very common in day to day operations on the ESB layer.

Sender

The next image is to show an example of how to pass the values. Here I am inserting one JSON into the queue. The moment you place it in the Payload section, your Send button will be activated. Click on it and the message would be placed into your queue. You will see a green pop up, if successful. For a failure, the pop up would be red.

Sender-2

Message Browser

Now, click on the message browser and you can see the Get Messages button. You can configure the number of messages and polling frequency for the queue.

browser-1

Now you can see the message what we have just inserted in the below image.

browser-2

You can see the message ID, timing of push, and content of the message. The one problem Anypoint MQ is currently having that there is no messageId-based pulling from the queue. This feature is very common with most on-prem queues and on cloud available with SQS by Amazon. I hope soon we will have more teeth to Anypoint MQ over cloud.

I have marked one icon in top right corner, which is Return Message". Whenever we click on the messag,e it becomes unreadable for the client who is reading the queue. You have to click on this icon to return the read message back to queue to make it readable.

There is an individual delete and purge (group delete) option if you want clear the queue. Please note all such operations are possible from the Mule flow if you are using Amazon SQS. Here, Anypoint platform is the place where we have to come to perform such operations (i.e. group deletion).

Now I should move towards how to make an Async design using MQ.

Async Implementation Using MQ

The design decisions are merit-based. There can never be only one approach. However, I can suggest the one I have implemented. Say for example I have to do a transaction between three systems (A-->B-->C). In this scenario, A-->Mule-->B and then B's response has to be moved into C for consumption. To make all the processes async, we have to place queues in between.

Happy Path: In this situation, A-->Mule-->A's response Q. Now the second flow would be like A's response Q-->Mule-->B-->B's response. You can visualize the design here. In the first flow, only you can send the response back to A about the message being queued, since we will make all effort to make.

Error Path: Suppose we are contacting system B, which is down currently in this scenario, we can place the payload to errQ so that it can be retried on a fixed interval and fixed number of retries. Now the question may come: why we do not make a NACK and keep the message in the normal queue. The logic behind this is that maximum designs will ask you to wait for a particular period of time before retrying. If you combine this with the normal Q then it would be messy. We can have an independent processing for errQ with a Poll component on different settings.

Another approach may be that you can calculate the number of retries from normalQ and then place to errQ. The MEL for it is "#[message.inboundProperties.headers.deliveryCount >${maxretries}]". You can configure the max retries you want.

Poison Path: Suppose there is some issue with the request which we are making to system B and this is resulting in failure each time. Eventually, the request can not be processed, so in this situation, we will place this message to PoisonQ. At the same time, we have to notify system A that the request could not be processed. We can place email alerts on these poisonQs which will notify administrators for further action on it.   

I have tried to provide some detailed insight into Anypoint MQ's workings. I hope this will be helpful in working/designing with Anypoint MQ.

Design Requests Flow (web browser) Icon JSON Cloud Payload (computing) Moment Polling (computer science)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Choosing the Best Cloud Provider for Hosting DevOps Tools
  • Spring Boot Docker Best Practices
  • What Java Version Are You Running? Let’s Take a Look Under the Hood of the JDK!
  • Last Chance To Take the DZone 2023 DevOps Survey and Win $250! [Closes on 1/25 at 8 AM]

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: