Technology Fridays: NATS Makes Application Messaging as Simple as Texting
Welcome to Technology Fridays! The world of application messaging platforms experienced a renaissance in the last few years with a group of innovative, open source platforms challenging the status quo established by incumbents such as Tibco(Rendezvous), IBM(WebSphere MQ) or Oracle. These days, when you think about application messaging platforms, names such as Apache Kafka or RabbitMQ come to mind. Today, I would like to cover another technology that I think you should add to that list: NATS
The brain child of developer -extraordinaire Derek Collison(Rendezvous fame), NATS is an ultra-fast, lightweight, open source messaging platform designed to support large-scale, distributed applications. There are a lot of adjectives in that states but, fundamentally, you should think about NATS as a messaging platform that was conceived from the ground up to support cloud infrastructures. Not surprisingly, NATS has evolved to become the massaging backbone of the Cloudfoundry platform as a service(PaaS) stack.
At its core, NATS is a high-performance, real time, publish-subscrive messaging platform. applications can send and receive messages to hierarchical subjects. At first glance, that doesn’t sound very innovative so what is it about NATS that makes it special in the messaging platform space?
Well, for starters, speed. NATS is optimized for processing high volumes of concurrent messages in real time. This is possible in part due to NATS non-persistent model that relies on short-term memory storage to relay messages between publishers and subscribers.
Another unique capability of NATS is its text-based protocol that exposes the capabilities of the platform via simple text commands. Differently form other messaging platforms that rely on binary protocols, developers can stop interacting with NATS via a simple telnet session. The NATS text-based protocol exposes commands such as CONNECT, PUB, SUB or MSG that abstract the main building blocks to exchange messages through the platform.
NATS is based on two main subsystems: NATS Messaging and NATS Streaming. NATS Messaging enables synchronous and asynchronous publish-subscribe exchanges between endpoints. NATS Streaming provides event streaming capabilities with robust delivery guarantees as well as message routing. One of the coolest capabilities of NATS Streaming is its ability to replay historical data using a secondary storage mechanism. NATS Streaming makes the platform a strong candidate for emerging scenarios in areas such as internet of things(IOT) or telemetry monitoring.
NATS was originally created in Go which means it was designed with concurrency as a first-class citizen. The NATS protocol includes important capabilities such as message ordering and delivery guarantees. NATS enforces message ordering in a per publisher basics but rarely across multiple publishers. Message delivering is enabled using an “at-most-once” model for NATS messaging applications or an “at-least-once” models for NATS streaming solutions.
Connectors are components responsible for integrating NATS with other technologies. For instance, a Redis connector relays messages from NATS to the Redis Pubsub subsystem. The NATS Connector Framework enables the implementation of custom connectors using a consistent programming model.
The messaging platform space is crowded with innovative platforms that can be considered NATS competitors. Definitely way too many to cover here. Technologies such as RabbitMQ, ZeroMQ, Apache Kafka and Kafka’s famous enterprise distribution Confluent are some of the best regarded technologies in the space. Also, legacy messaging platforms such as tibco Rendezvous are still very relevant in the market.