Messaging and a reliable yet efficient integration of heterogeneous set of systems & applications with a proper messaging model plays a very important role in any organization in order to ensure that different systems & applications are able to share data with each other in a secure, reliable, efficient manner to meet business goals. When we talk about messaging between systems & applications, two modes of communications are considered: synchronous messaging and asynchronous messaging and when we talk about the approach to be followed for both modes; that’s where a debate between direct point to point link between systems vs use of a message broker comes in.
In this tutorial, we will explain basics of a Message Broker, introduction of Apache ActiveMQ, basic concepts of ActiveMQ, Apache ActiveMQ use-cases and benefits of using Apache ActiveMQ.
Why Use Message Broker: A shift from Synchronous to Asynchronous Message Communication
In a typical point-to-point synchronous communication model, message producer and message consumer are tightly coupled and producer has to wait for the consumer to consume the message and acknowledge or else receive a timeout and only then producer thread is released and available for any subsequent processing. Unless there is a business requirement for such synchronous messaging, use of such a model can cause performance issues and on top of that; such point to point direct integrations between heterogeneous systems and applications are hard to implement, manage and scale. To avoid such situations, organizations shift towards a broker based messaging model to decouple these systems where a message broker sits in between to mediate and let message producers and message consumers continue their primary tasks without waiting each other with every message.
A message broker is responsible for enabling different systems to communicate each other in the form of messages in an asynchronous mode. Message broker takes the responsibility of receiving messages with different supported protocols and formats, storing messages for reliability, performing any additional mediator level actions. Some message brokers also provide features like data translations, data marshalling additional to data routing and persistence.
Message broker provides destinations (queues & topics) which can be used by message producers and message consumers for pushing and pulling messages. Message brokers but pub-sub and Point to Point communication modes through topics and queues respectively.
Apache ActiveMQ: Introduction of ActiveMQ and Basic Concepts of ActiveMQ Explained
Apache ActiveMQ is a well known and widely used open-source Message Broker. ActiveMQ is a multi-protocol Java based message oriented middleware which acts as a JMS Provider implementing JMS Specifications.
ActiveMQ provides rich set of features for organizations to implement messaging for different systems and applications in an efficient, reliable and secure manner. With JMS Specifications at its core, Apache ActiveMQ supports but pub-sub and point to point messaging through Topics and Queues Respectively.
With support of multiple protocols and data formats, ActiveMQ is capable of supporting different types of clients and applications written in different languages and supporting different protocols can seamlessly integrate with ActiveMQ broker to achieve the desired goal of messaging. ActiveMQ supports REST API, AMQP, STOMP, MQTT and various other wire level protocols.
ActiveMQ Example Use-Cases
Message brokers like Apache ActiveMQ can fit in plenty of situations and with its rich features and wide protocol supports and available client APIs, It can be used for any messaging requirement where a decoupled asynchronous communication is required for different systems and applications.
A few example use -cases for Apache ActiveMQ are as below:
* Web Portals: Asynchronous Messaging across modules
* Order Processing Systems Integration
* Partners/Clients Messaging/Broadcasting System
* IoT messaging
Benefits of Apache ActiveMQ
Apache ActiveMQ as an open-source message oriented middleware not only helps organizations cut down any costs associated with purchase of any proprietary message brokers licenses but also benefits in long run with its tons of enterprise level rich features which make ActiveMQ among the major choices to consider for setting up an integration environment.
Some of the major benefits of Apache ActiveMQ are listed below:
* With Apache ActiveMQ, you can achieve asynchronous decoupled messaging for different systems and applications which helps isolating message producers and message consumers from each other making it easier to scale, modify those systems in a transparent manner.
* With support of multiple protocols and data formats, Apache ActiveMQ enables integrating heterogeneous systems without restrictions of limiting to specific protocol requirements. Applications written in any programming languages, legacy as well as proprietary applications can easily adjust in this integration eco-system with such flexible messaging features of Active MQ.
* ActiveMQ with JMS specifications and its added features provide a higher level of reliability making it a good choice for data critical and mission critical implementations. With persistence, durable subscriptions, brokers clustering; ActiveMQ based messaging environment can have a higher degree of reliability.
* ActiveMQ is highly scalable and an ActiveMQ cluster can be horizontally scaled by adding more brokers into the cluster to meet growing messaging needs.
* ActiveMQ provides rich set of administration options through its administration console UI which can be used to perform various administrative tasks for ActiveMQ based messaging environment.
If you are from MuleSoft background, You can refer to another tutorial where I explained how to integrate with Apache ActiveMQ in MuleSoft.
ActiveMQ Interview Questions and Answers are also covered in my another article. If you have any questions or ambiguities, feel free to comment below.
Pingback: MuleSoft JMS Tutorial: ActiveMQ Integration Using Queues and Topics | TutorialsPedia
Pingback: RabbitMQ Introduction: RabbitMQ Beginners Tutorial | TutorialsPedia
Hi..
That’s a very nice informative article.
I have a Question : Lets Say I have a Queue and to that queue I got 1 application as Publisher and another node as consumer with consumer count as 200. If the publisher push 200 messages then how these messages are consumed by 200 consumers ?? Will it be in Round Robin mechanism or will be some other mechanism. ?
Pingback: Event-Driven Architecture How Event Driven Architecture Work