We will consider the pros and cons of ActiveMQ and Redis Pub/Sub. Although these solutions aren’t very suitable for processing big data, they provide a strong basis for creating small business analytics tools.
Pricing: free
Official website: http://activemq.apache.org
Useful resources: AmazonMQ
Pros:
Cons:
ActiveMQ is an Apache product written in Java. Developers, who don’t need to deal with huge amounts of data, usually prefer this simple and reliable open source solution. The message broker has become popular due to its fast work and compatibility with many protocols and advanced technologies.
At the beginning of ActiveMQ development, there were 2 reasons to start out the project:
Unlike its competitors (EMS/TIBCO, SonicMQ, WebSphereMQ), the messaging system combined accessibility with useful and effective features. So, it became popular among great companies form the main industries. LogicBlaze developed the free message broker in 2004. It was hosted by the CodeHaus. In 2007 the system was donated to the ASF. Its founders continued developing the product. ActiveMQ is actively maintained today.
The message-oriented middleware provides excellent opportunities for Java developers. The system is based on JMS standards specification and supports async communication. So, it allows the programmer to organize fast and stable messaging process within enterprise projects. I can define 3 key advantages of the messaging system.
2. Convenience: The message broker is based on the JMS API. As a result, the processes of creating, transmitting, and receiving messages are determined by the unified standard. Except for Java, ActiveMQ clients can be written in other programming languages. They are Python, Node.js, and Ruby.
3. Flexibility: The messaging system works fast enough and helps to use Enterprise Integration Patterns and other modern solutions. At the same time, it’s quite easy to access and get used to. Simple configuration of the message broker is an important advantage for the implementation of enterprise projects. Moreover, ActiveMQ supports many protocols (WebSockets, AMQP, REST, OpenWire, STOMP, MQTT, etc).
Just like other messaging systems, the program transmits data from one application (producer) to another (consumer). So, its architecture includes:
The message broker routes each message through one of 2 types of destinations:
Thanks to the asynchronous process of message delivering, the consumer app doesn’t need to receive it immediately. ActiveMQ separates the 2 tasks:
So, the applications are independent of each other. The producer’s task is completed as soon as it sends a message to a broker. It’s no matter whether or when a consumer app fetches the message. This type of messaging is called loose coupling and provides some benefits for the developer.
All in all, I recommend Apache ActiveMQ as a hybrid and flexible message broker. It’s especially suitable for enterprise projects. ActiveMQ is relatively easy to set up in complex structures, shows good reliability and high throughput.
Pricing: free
Official website: https://redis.io
Useful resources: tutorial
Pros:
Cons:
The advanced database is written in C. First of all, Redis performs functions of storing data, but it also provides an opportunity of messaging. It helps to create fast, scalable applications. Released under a BSD 3-clause license, Redis is quite popular for the development of tech solutions for small and medium business.
Created in 2009, the REmote DIctionary Server still remains an open source project. Its founder worked on his own European startup. It was a real-time web log analyzer, which required increasing of scalability. Facing some challenges with workloads while using traditional databases, the programmer started development of the first version of Redis. He made the project open source and received support from the Ruby community. Instagram and GitHub were among the first great projects adopting the new database. The last program’s release included a new data structure for storing multiple fields and string values with an automatic, time-based sequence.
Implementing the messaging system for queue applications, Redis Pub/Sub works with 3 main terms:
Original published at freshcodeit.com
It’s also important that the number of channels isn’t limited for a single subscriber. At the same time, publishers are able to send messages to any number of subscribers on a channel. Since all messages in the Publisher/Subscriber platform are fire-and-forget, they are deleted in case of no subscriber determined.
Note: You should know that “redis-cli” won’t accept any commands once in subscribed mode. It can only quit the mode with Ctrl-C.
Just like ActiveMQ, Redis Pub/Sub publishers and subscribers are independent of each other. So, when the first of them sends a message, it doesn’t know what receivers are connected to that channel. This is also true for the receivers that subscribe to channels, without knowledge of other publishers.
One of the main advantages of this technology is the opportunity to use clients written in different languages. You can read the full list. It includes such popular solutions, as Ruby, Python, PHP, Objective-C, Node.js, Java, Clojure, C++, C#, etc.
Using Redis’ Pub/Sub within your infrastructure, you will enjoy quick messaging and communication between processes. The broker’s simplicity and performance make it popular for a wide range of use cases. Taking into account the famous database and the cache feature, Redis can become a handy technology for your future project.
Here we end our journey through the self deploy messaging systems. Let me know if you like such reviews and your opinions about all of these technologies.
The original article Introduction to message brokers. Part 2: ActiveMQ vs Redis Pub/Sub was published at freshcodeit.com.