Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Demonstrating Red Hat JBoss AMQ 7 HA Replication Failover

August 4, 2017
Hugo Guerrero
Related topics:
Java
Related products:
Streams for Apache Kafka

Share:

    A few weeks ago, the newest version of Red Hat JBoss AMQ was released. AMQ 7 is the result of Red Hat’s efforts on creating a unified messaging platform for its middleware offerings. One of the most interesting features of this new version is the new backing strategy for failovering when configured in high availability. This feature allows clients connections to migrate from one server to another in the event of server failure so client applications can continue to operate.

    AMQ 6.x already had an option to configure failover using a shared store, usually backed up by a shared filesystem or a JDBC connection to a database. However, that option involved the use of external infrastructure add-on in hardware and software, representing an increase in overall deployment costs.

    In AMQ 7, support for network-based replication was added. When using replication, the live and the backup servers do not share the same data directories; all data synchronization is done over the network. Therefore, all (persistent) data received by the live server will be duplicated to the backup.

    amq-ha-replicated

    The above figure shows the basics of AMQ 7 replication ha policy.

    The Replication (Shared Nothing) Demo project is a demonstration of the new AMQ 7 replicated high availability feature to avoid using a shared store. This project demonstrates how to set up a live broker and its corresponding backup using AMQ’s command line interface (CLI) and configure the replication ha fail-over policy.

    You will need a Linux or Mac laptop with at least 2GB RAM (4GB preferred) and a couple of GB of free disk space. A Java Virtual Machine version 8 should be installed in the system as well. With those prerequisites covered, you can deploy your brokers following the next steps:

    1. Download and unzip this demo of clone the Github repository.
    2. Download the JBoss AMQ Broker from Red Hat Developer Portal: —download here; add to installs directory (see installs/README).
    3. Deploy the demo using the automated installation script ‘init.sh’,
      ./init.sh
      

      After successfully deployed, you can test the failover.

    Sending messages

    To send messages to the master broker, execute the following command:

    $ target/amq-broker-7.0.1/instances/replicatedMaster/bin/artemis producer --message-count 10 --url "tcp://127.0.0.1:61616" --destination queue://haQueue
    

    Browse messages on Master

    To check the messages, which were successfully sent to the broker, check the queue in the broker web console.

    • Open a web browser and navigate to the AMQ web console, http://localhost:8161/hawtio.
    • In the left tree navigate to 127.0.0.1 > addresses > haQueue > queues > anycast > haQueue.
    • Click on Browse (refresh if necessary).

    You will see the 10 messages sent by the producer script.

    Browse backup Console

    As the replicatedSlave broker is running as a backup broker for replicatedMaster, there are no active addresses or queues listening.

    • Open a web browser and navigate to the AMQ web console http://localhost:8261/hawtio
    • In the left tree navigate to 127.0.0.1 > addresses > haQueue > queues > anycast > haQueue

    You will only see the information regarding the cluster broadcast configuration.

    Master shutdown

    To shutdown the master broker, execute the following command:

    $ target/amq-broker-7.0.1/instances/replicatedMaster/bin/artemis-service stop
    

    While the master is shutting down, the backup broker will notice the disconnection from the master and will become live.

    Browse messages on Slave

    To check the messages that were successfully replicated to the slave broker, check the queue in the slave broker web console.

    • Refresh the AMQ web console http://localhost:8261/hawtio
    • In the left tree navigate to 127.0.0.1 > addresses > haQueue > queues > anycast > haQueue
    • Click on Browse (refresh if necessary)

    You will see the 10 messages sent by the producer script to the master broker.

    Failback

    If you want, you can start again the replicated Master broker to see how the backup failbacks to the master.

    $ target/amq-broker-7.0.1/instances/replicatedMaster/bin/artemis-service start
    

    The master will start and check if there is a live broker when the backup detects that the master has become available again, it fails back going into a backup mode again.

    Now you are up and running with a fully installed and backed up AMQ 7 broker!

    For more information, check the Red Hat Developers Program site that provides useful blogs and content about Red Hat JBoss AMQ.


    Download  Red Hat JBoss AMQ for development use.

    Last updated: August 3, 2017

    Recent Posts

    • More Essential AI tutorials for Node.js Developers

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue