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

Automated migration from JBoss AMQ 6 to Red Hat AMQ 7 on Red Hat OpenShift

 

May 1, 2019
Roman Martin Gil
Related topics:
LinuxKubernetes
Related products:
Streams for Apache KafkaRed Hat OpenShiftRed Hat OpenShift Container Platform

Share:

    Since Red Hat OpenShift Container Platform was first released, Red Hat Middleware products were provided to deploy on it and help developers to build more complex solutions. Messaging Brokers are a very important piece in most new application architectures, such as microservices, event sourcing, and CQRS. Red Hat JBoss AMQ was provided from the beginning to deploy Messaging Brokers on Red Hat OpenShift easily.

    Red Hat AMQ 7 is the latest version of a high-performance, scalable, and multi-protocol broker based on the Apache ActiveMQ Artemis open source project. It is also available as a containerized image for use with Red Hat OpenShift, so it allows developers to quickly deploy messaging brokers in a cloud environment.

    There is a Red Hat AMQ 7 migration guide with the most important topics; however, how to do this on Red Hat OpenShift is not completely covered. From my field experience with customers, we defined an automated process to do it on OpenShift including:

    • Zero downtime for consumers and producers
    • Move any persisted message from Red Hat JBoss AMQ 6 to Red Hat AMQ 7
    • Automated using Ansible Playbooks

    Migration Process

    Red Hat JBoss AMQ 6 (AMQ 6) provides a drainer pod, only available for persistent templates, which is responsible for managing the migration of messages. When AMQ 6 is deployed using a multi-node configuration, it is possible for messages to be left in the KahaDB store directory when the AMQ 6 cluster is scaled down. To prevent messages from remaining, the drainer pod will recover them and move them to other AMQ 6 pod instance. Behind the scenes, a network of brokers is established between the drainer pod and other AMQ 6 pods.

    Red Hat AMQ 7 provides the same protocols that previous version. The drainer pod uses OpenWire protocol to move messages, so we will use it to move messages to the new Red Hat AMQ 7 broker.

    We need to change the service selectors of each AMQ 6 protocol service (openwire, amqp, stomp, mqtt) to identify the new Red Hat AMQ 7 pod instances. When an AMQ 6 broker is scaled down (replicas = 0), the drainer pod will move the persisted messages.

    This feature defines a very straight forward migration process as:

    1. Scale up Red Hat AMQ 7 broker and wait to be ready.
    2. Patch AMQ 6 services to balance connections to Red Hat AMQ 7 broker pods.
    3. Scale down AMQ 6 drainer (it will be started later).
    4. Scale down AMQ 6 broker to avoid new connections. New connections are established to new Red Hat AMQ 7 broker.
    5. Scale up AMQ 6 drainer to drain messages to new Red Hat AMQ 7 broker.
    6. Check AMQ 6 drainer concluded two migration cycles. If after two cycles there are not messages to migrate, we can confirm that drainer finished successfully.
    7. Scale down AMQ 6 drainer.

    Ansible Playbook

    The migration process described above includes steps and checks, which are very easy to execute manually. However, it could be more difficult if you need to do this for each AMQ 6 broker deployed in Red Hat OpenShift. Ansible playbooks and Ansible roles can help you automate it easily.

    I developed a simple Ansible playbook to migrate brokers using command module and OpenShift CLI. Of course, there are other alternatives to implement other approaches, such as, oc module, openshift_raw module, openshift module, etc.

    This Ansible playbook sample is available in this GitHub repository.

    Conclusions

    This article shows how easy it is to migrate Red Hat JBoss AMQ 6 brokers to Red Hat AMQ 7 brokers on Red Hat OpenShift. Do not miss the opportunity to get the best improvements of Red Hat AMQ 7 in your Red Hat OpenShift deployments.

    Last updated: June 30, 2023

    Recent Posts

    • How Trilio secures OpenShift virtual machines and containers

    • How to implement observability with Node.js and Llama Stack

    • How to encrypt RHEL images for Azure confidential VMs

    • How to manage RHEL virtual machines with Podman Desktop

    • Speech-to-text with Whisper and Red Hat AI Inference Server

    What’s up next?

     

    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