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 Video Library
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
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

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Cracking the Code: Machine Learning Unveils the Secrets of Fault Diagnosis and Root Cause Analysis
  • You Can Keep Your Job, but It Won’t Be the Same Job
  • Patterns To Make Synchronous Communication in Microservices Resilient
  • Circuit Breaker Pattern With Netflix-Hystrix: Java

Trending

  • Reflections From a DBA
  • Extracting Maximum Value From Logs
  • The Winds of Change: How Generative AI is Revolutionizing Cybersecurity
  • AWS vs. Azure vs. Google Cloud: Comparing the Top Cloud Providers

Achieve Fault Tolerant Messaging with MQ Gateway

Learn how you can achieve fault tolerant messaging using the MQ Gateway feature of JBoss Fuse 6.2 to provide a single IP and port to accept connections from clients.

Christina Lin user avatar by
Christina Lin
CORE ·
Aug. 21, 15 · Tutorial
Like (2)
Save
Tweet
Share
2.86K Views

Join the DZone community and get the full member experience.

Join For Free

Sometime ago I posted a blog about achieving fault tolerant messaging; in the article, I mention using fabric registry discovery to hide all the IP address and port details in the client side. With new Fuse 6.2, you will not be able to find this anymore. So how do we achieve fault tolerant messaging in the new Fuse?

In JBoss Fuse 6.2, we can do it by starting up a MQ Gateway. What it does is it provides a single IP and port to accept connections from clients. All the individual IPs and Port of the broker are hidden away tothe client, the client only needs to know the IP and port of the MQ Gateway (Default Port: 61616). The gateway will discover all the brokers in the fabric, and no matter what the incoming protocol is, it can be OpenWire, MQTT, STOMP and AMQP. The gateway will see which broker is available in the host specified for the protocol, and connect the client to the broker. If multiple brokers are available in the host group, gateway can dispatch request to them, by this we can achieve load balance. There are 3 different way to do load balance, Random, Round Robin and Sticky.

If any thing goes wrong with the broker a client is connecting, and got disconnected, the gateway will look for another available broker in the group. This gives you high availability to your service.

To startup a MQ Gateway, simply choose the gateway-mq profile to the container.

It will automatically find brokers in fabric:


I updated my failover demo instead of using fabric registry discovery, I change my application and connect it to MQ Gateway.  In this demo, you will first need to create a broker failoverMS, choose Master/Slave type and use blogdemo as Group.

Click on the red triangle to start provision the brokers. It will take you yo the page to create container for the broker profile.

And will start create number of container you specified in the configuration.

Then we can startup the MQ-Gateway, before we do that, go to the gateway-mq profile and edit the io.fabric8.gateway.detecting.properties file. Change port to 8888 and defaultVirtualHost to blogdemo.

And add the gateway-mq profile to a container, as previously stated.

Let's take a look at the client application, it's written with Camel. Look at the configurations in the Camel route, here you see no matter if it's an OpenWire or MQTT protocol, it is set to tcp://localhost:8888, which is the IP and port of MQ Gateway.

This application send a message to the broker, through OpenWire and MQTT protocol every 5 secs. Deploy the profile "" to a new container.

Go to container console of testcon, you will find the camel routes are running.

In the MQ Gateway, you can see the request was dispatched to the broker we have created.

And the messages was sent to broker.

Video can be found here.

The application code can be found here.
https://github.com/jbossdemocentral/jboss-fuse-mqgateway-failoverdemo

Fault (technology)

Published at DZone with permission of Christina Lin, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Cracking the Code: Machine Learning Unveils the Secrets of Fault Diagnosis and Root Cause Analysis
  • You Can Keep Your Job, but It Won’t Be the Same Job
  • Patterns To Make Synchronous Communication in Microservices Resilient
  • Circuit Breaker Pattern With Netflix-Hystrix: Java

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

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

Let's be friends: