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
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • From Code to Customer: Building Fault-Tolerant Microservices With Observability in Mind
  • Designing Fault-Tolerant Messaging Workflows Using State Machine Architecture
  • Mutation Testing: The Art of Deliberately Introducing Issues in Your Code
  • Architecting for Resilience: Strategies for Fault-Tolerant Systems

Trending

  • From Issue to Reviewable Patch: Build a Sandboxed Coding Agent With Deep Agents and Automated Tests
  • PII Detection Before RAG Ingestion: Screening Documents in C#
  • AI Coding Agent Guardrails: Finding Gaps in Tool Permissions
  • PWA on iOS, Part 3: Chrome on iPhone Is WebKit Too. How One Engine Sets the Rules for PWAs on iOS

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

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.

By 
Christina Lin
DZone Core CORE ·
Aug. 21, 15 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
3.9K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • From Code to Customer: Building Fault-Tolerant Microservices With Observability in Mind
  • Designing Fault-Tolerant Messaging Workflows Using State Machine Architecture
  • Mutation Testing: The Art of Deliberately Introducing Issues in Your Code
  • Architecting for Resilience: Strategies for Fault-Tolerant Systems

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

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 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook