A message broker is an intermediary program that translates messages from the formal messaging protocol of the publisher to the formal messaging protocol of the receiver. Message broker programs are sometimes known as middleware.
In a publish/subscribe architecture for machine-to-machine (M2M) communication in the Internet of Things (IoT), this means that the message broker decouples communication between devices that publish information and other devices that subscribe to the information.
Decoupling allows the publishing device, which might be a sensor, not to have to know anything about subscribers; it only has to send messages to the broker and then the broker manages and distributes the messages. Messages can be buffered in a queue if the receiver cannot keep up with processing incoming messages.
Because subscribers and publishers never communicate directly with each other, there is less risk of a publisher being directly attacked by a subscriber. The message broker, on the other hand, can become a target for attacks if not configured properly.
Popular message brokers include:
Apache ActiveMQ – written in Java and uses the Java Message Service API to create, send and receive messages.
Apache Kafka – written in Scala and Java and written in Scala and Java and originally designed by LinkedIn. Designed for high volume streams and fast transmission.
AWS IoT message broker – publish-subscribe broker service that enables the sending and receiving of messages to and from AWS IoT.
RabbitMQ – open-source enterprise messaging system modeled on the Advanced Message Queuing Protocol (AMQP) standard. Plug-ins support Message Queuing Telemetry Transport (MQTT) and Streaming Text Oriented Messaging Protocol (STOMP).
Kestrel – runs on the JVM and based on the memcached protocol. Known for being simple and fast.