top of page

What is Message Broker?

Oct 24
12 min read

Updated: Oct 27

What is Message Broker?

 

A message broker is software that receives application messages and routes them between producers and consumers. It manages the hand-off using configured destinations, subscriptions and delivery rules, so the sending application does not need a direct connection to every recipient.

 

A home-lab monitoring agent could publish a router status event once, while a dashboard and an alerting service receive it independently. A different arrangement could place a backup job in one queue for an available worker to process. Both use messaging, but they distribute responsibility differently.

 

The broker's presence alone does not guarantee persistence, replay, ordering or successful business processing. Those depend on the messaging pattern, protocol, configuration and application behaviour. The useful question is what the broker accepts responsibility for, and where that responsibility ends.

 

What does a message broker actually do?

 

A producer creates a message. The broker accepts it under a protocol, applies routing rules and makes it available to the relevant destinations or subscribers. Consumers receive messages and perform the application work.

 

Element

Purpose / Example

Producer or publisher

Purpose: Create and submit a message; Example: A monitoring agent reports a state change

Broker

Purpose: Mediate routing and delivery; Example: A server matches a topic to subscriptions

Destination or subscription

Purpose: Define where work or events belong; Example: A job queue or an alerting subscription

Consumer

Purpose: Receive and act on messages; Example: A worker stores a reading or updates a dashboard

 

The broker can centralise connection management, routing, access control and delivery state. Some products also provide durable queues, retained records, replay, expiry or protocol bridges. These are capabilities to verify rather than properties shared by every broker.

 

It is an application intermediary, not an IP router. Routers forward network packets towards addresses. A broker interprets messaging-level information such as a destination name, routing key or topic filter.

 

A message's route through the system

 

Consider a synthetic event saying that a router's WAN state changed:

 

  1. The producer creates the payload and a stable event identity.

  2. It connects to the broker with the appropriate credentials and publishes to a destination or topic.

  3. The broker checks permissions and applies the configured routing rules.

  4. Each relevant destination or subscriber receives responsibility under its delivery contract.

  5. Consumers process the event, record the required outcome and advance their delivery state appropriately.

 

The exact sequence of acknowledgements and storage operations differs between protocols and products. A successful socket write is only evidence about the client's local sending operation. A broker acceptance response is not automatically evidence that every consumer finished.

 

What is Message Broker infographic explaining the mechanism, key stages and practical limits.

 

How does a broker decide where a message goes?

 

In RabbitMQ's AMQP 0-9-1 model, producers publish to an exchange. Bindings connect that exchange to destinations, and the exchange type determines routing. The RabbitMQ exchange documentation distinguishes exact-key routing, unconditional fan-out and pattern matching.

 

Routing approach

Decision / Example consequence

Direct

Decision: Match the binding key exactly; Example consequence: A matching key can route to more than one bound queue

Fan-out

Decision: Route to every bound destination; Example consequence: Audit and notification queues each receive a copy

Topic pattern

Decision: Match structured routing keys; Example consequence: Different subscribers select different event families

Header or property rules

Decision: Inspect supported message attributes; Example consequence: A configured rule selects a destination by metadata

 

Direct routing does not mean “one worker”. Routing selects destinations; consumers sharing one destination make a separate work-sharing decision. An exchange and its bindings are also not substitutes for a correctly configured queue's storage and recovery behaviour.

 

Topic syntax is not interchangeable

 

RabbitMQ topic exchanges separate routing-key segments with dots. Their asterisk wildcard matches one segment, while the number sign matches zero or more. MQTT instead uses slash-separated topic levels, with + for one level and # for multiple levels; its multi-level wildcard must be last.

 

Do not transfer a filter from one protocol to another by changing only its name. Check separators, wildcard rules, case sensitivity, special namespaces and authorisation behaviour. A filter that is valid but matches nothing can look like a network failure when the broker is actually following its configuration.

 

What did our real local broker test show?

 

Techie Broadband ran a disposable MQTT broker on 26 October 2026. The environment used Python 3.12.14, aMQTT 0.12.1 and Eclipse Paho MQTT Python 2.1.0, communicating over actual TCP on 127.0.0.1. The protocol was MQTT 3.1.1, not MQTT 5.

 

The broker used an automatically selected local port, clean client sessions and no persistence plugin. Publications used QoS 1. Subscriptions were established and acknowledged before the matching test messages were published. All 20 recorded checks passed, covering routing, retained-state behaviour, independent deliveries, reconnect behaviour and listener cleanup.

 

This was a local functional test, not a broker throughput comparison, cloud service test or ISP measurement. Its anonymous plaintext connection was confined to loopback and removed afterwards. It is not a production deployment example.

 

Three filters, five publications and nine deliveries

 

Three independent clients subscribed to home/router/status (A, exact), home/+/status (B, one-level) and home/# (C, multi-level). We then sent the following five publications. The values below were observed at the clients, rather than inferred from a routing diagram.

 

Publication

Observed matching subscribers

home/router/status: up

A exact, B one-level and C multi-level: 3 deliveries

home/router/status: down

A exact, B one-level and C multi-level: 3 deliveries

home/router/wan/status: nested

C multi-level only: 1 delivery

home/switch/status: switch

B one-level and C multi-level: 2 deliveries

office/router/status: office

None of these three subscribers: 0 deliveries

 

The exact subscriber received two messages, the one-level subscriber three and the multi-level subscriber four: nine deliveries from five publications. The deeper WAN topic did not match the one-level filter. The office publication was acknowledged to its publisher but produced no delivery to these three home subscriptions.

 

That last result illustrates an important diagnostic boundary. A publisher can complete its protocol exchange without the application's intended subscriber receiving the message. The configured subscription must match as well.

 

Late subscribers and reconnects

 

We also published two successive retained values on state/router, then connected a new subscriber. Separate checks cleared the retained state and disconnected a clean-session client while an unretained event was published.

 

Test

Observed outcome / Interpretation within this setup

Publish retained old, then retained new

Observed outcome: Late subscriber received new with retained flag; Interpretation within this setup: Latest retained state, not both historical events

Publish a zero-byte retained payload

Observed outcome: A new subscriber received no retained value; Interpretation within this setup: The stored retained value was cleared

Publish an unretained event while a clean-session client was absent

Observed outcome: Reconnected client received no missed event; Interpretation within this setup: This setup did not preserve that event for it

Publish a fresh event after the client returned and subscribed

Observed outcome: Client received after-return; Interpretation within this setup: New live delivery worked

 

Absence checks used finite 250 ms observation windows in this local test. They are not a universal timing guarantee. Every client was disconnected, the broker was shut down cleanly and the listener was checked closed. The Python test command completed with exit code 0.

 

The experiment did not test persistent sessions, broker restart, disk recovery, MQTT 5 shared subscriptions, fault-injected QoS recovery, TLS or authorisation. Those limits matter when interpreting what “the broker worked” actually proves.

 

Is fan-out the same as sharing work across consumers?

 

No. Independent subscribers can each need the same event. Competing workers normally share responsibility for the jobs in one work destination.

 

In another part of the MQTT test, two independent subscribers listened to events/test. Each received both event-1 and event-2. They did not divide the two events between them. Adding an ordinary subscriber therefore increased deliveries rather than adding a worker to one shared job queue.

 

If four workers should share one set of jobs, use the product's work-sharing mechanism. That could be consumers on a common queue or a supported shared subscription. MQTT 5 defines shared subscriptions separately from ordinary subscriptions. Support and behaviour must be checked for the broker and client versions in use; our MQTT 3.1.1 experiment did not test them.

 

Our queue system guide explains the delivery, acknowledgement and backlog lifecycle after work has reached a queue. Broker routing decides which destinations participate in that lifecycle.

 

The payload cost of independent subscribers

 

Suppose 100 messages each contain 1,024 bytes of payload. Four independent subscriptions that each receive every message produce 400 logical consumer deliveries, carrying 409,600 payload bytes in total. Sharing 100 jobs once across four workers carries 102,400 payload bytes across the worker deliveries.

 

A separate executable Python calculation checks this illustrative arithmetic without contacting a broker:

 

Distribution model

Checked logical payload total

Four independent subscriptions

100 × 1,024 × 4 = 409,600 bytes (400 KiB)

One shared work set

100 × 1,024 = 102,400 bytes (100 KiB)

 

These are illustrative logical payload totals: 400 KiB versus 100 KiB. They exclude the producer's incoming traffic, protocol headers, TLS, acknowledgements, retries and replication. They do not claim that the broker stores four physical copies or that a particular broadband link carried those measured bytes.

 

Independent destinations also need independent recovery decisions. If an alerting subscriber is current while an audit subscriber is behind, one global “messages processed” count hides the audit gap. Measure each required subscriber's progress towards its own outcome.

 

Broker, queue and event log: what is the difference?

 

A broker is the intermediary service. A queue is a destination or mechanism for holding and distributing work. A retained log stores records with positions so consumers can track and revisit history within retention limits. A product can support more than one pattern.

 

Contract

What a consumer normally tracks / What to check

Work queue

What a consumer normally tracks: Delivery ownership and acknowledgement; What to check: Redelivery, expiry and competing consumers

Ephemeral publish/subscribe

What a consumer normally tracks: Live subscriptions and received messages; What to check: What happens while a subscriber is absent

Retained last state

What a consumer normally tracks: Latest retained value for a matching topic; What to check: Replacement, clearing and freshness

Retained event log

What a consumer normally tracks: Position in available record history; What to check: Retention, replay and output consistency

 

For example, Redis Pub/Sub documentation describes at-most-once delivery: disconnected subscribers cannot recover missed publications through Pub/Sub itself. That differs from Redis Streams. The product name alone therefore does not establish the delivery contract.

 

In the traditional Kafka log model, consumers maintain positions in retained records. Reading a record does not mean immediately deleting it for every other consumer. This is useful for independent processing and replay, but retention and the consistency of each consumer's output still need design.

 

Stream processing is another layer: computation over arriving records, often using a broker or log as input. Our stream processing guide separates transport and storage from the state, timing and results of that computation.

 

What do delivery guarantees actually cover?

 

Delivery guarantees describe a boundary under specified failure assumptions. They are not universal promises about all side effects triggered after delivery.

 

MQTT defines QoS 0, 1 and 2 as at-most-once, at-least-once and exactly-once delivery respectively. The MQTT 3.1.1 standard specifies those protocol exchanges and topic behaviour. Publisher-to-broker and broker-to-subscriber exchanges have their own state; the QoS chosen for a publication does not simply override every subscriber's delivery settings.

 

An exactly-once protocol exchange does not make a consumer's database write and an external notification one atomic business operation. A handler can accept a delivery, change another system and fail before recording its own progress. Recovery must account for the effect already performed.

 

Acceptance, routing, receipt and business completion

 

RabbitMQ distinguishes publisher confirms from consumer acknowledgements. Its AMQP 0-9-1 documentation also notes that an unroutable publication can receive a confirm; mandatory-return handling is a separate routing check. A confirm is therefore not a shortcut for proving that the intended consumer acted.

 

Similarly, a consumer library's callback receiving bytes is not proof that the application completed the required action. Define when the consumer commits its result, acknowledges responsibility or advances a position. Keep a stable event identity separate from protocol packet identifiers and individual delivery attempts.

 

Use idempotency and appropriate transaction boundaries where repeated processing could cause harmful duplicate effects. No broker setting can silently make an unrelated remote API join the broker's transaction.

 

Repeated delivery is not historical replay

 

A redelivery is another attempt to deliver work whose responsibility has not been settled. Replay is deliberately reading earlier records again. A retained latest value is different from both: it gives a subscriber the currently stored state for that topic, not a complete sequence of past updates.

 

Persistent session state is a further concept. It can preserve subscriptions and qualifying pending deliveries under the protocol and broker configuration. It is not synonymous with retained state, infinite message history or survival of every storage failure.

 

Our local retained-value test is useful precisely because it exposes the difference: old and new were published, but the late subscriber saw only new. An audit system needing both transitions needs a history-preserving design.

 

Does a broker remove coupling between applications?

 

It removes some direct connection and timing dependencies, but the applications still share a contract. They need to agree on destination names, event meaning, payload structure, identity, ownership and compatibility rules.

 

A routing key can send a message to the correct consumer while its payload remains unusable. Validate required fields, data types, units and supported schema versions. Introduce compatible changes deliberately and keep representative messages for testing consumers before a producer changes.

 

It also helps to distinguish an event from a command. “Backup completed” reports something that happened. “Start backup” asks a component to do something. Several independent applications may legitimately observe the first, while broadcasting the second to multiple executors could start multiple backups unless ownership is explicit.

 

Routing rules are operational configuration. Deleting a binding, changing a topic prefix or replacing a subscription can alter delivery without changing any application code. Treat topology changes as changes to the application contract, with a migration and verification plan.

 

How do you keep a broker reliable and secure?

 

Start by naming the failures the deployment must tolerate. A client disconnect, a broker process restart, a failed disk and a lost site are different events. Durable metadata, message persistence, replication and client recovery settings each address particular parts of the problem.

 

Bound input sizes, waiting work and consumer activity. A slow independent subscription can accumulate its own backlog or be disconnected under a service's resource policy. Adding more subscribers or workers does not remove a shared database, storage or upstream bottleneck.

 

Authentication establishes who is connecting. Authorisation determines what that identity can publish, consume or configure. Give producers and consumers only their required destinations and administration rights, and use protected transport where the deployment needs it. A broad wildcard subscription must not become a route to data the application should not see.

 

Treat the broker as a privileged input boundary. Validate messages, avoid executing payload text as a command and limit sensitive data in logs, retained values and failed-message stores. A broker cannot make an unauthorised producer trustworthy by delivering its message reliably.

 

Bridges and integrations add another boundary

 

A bridge or connector can move messages between brokers, protocols or HTTP services. That hand-off has its own acknowledgement, retry and outage behaviour. Check which metadata, ordering, identity and expiry information survives translation, and prevent messages looping back through the integration.

 

Webhooks are HTTP event notifications, rather than a synonym for a broker. A webhook receiver can place an authenticated event into a broker for later processing, but it needs a durable hand-off before reporting acceptance if loss is unacceptable.

 

Where is a message broker useful in a UK home lab?

 

A local MQTT broker can connect monitoring agents, dashboards and home automation services without every device knowing every consumer's address. The local exchange may keep working while broadband is unavailable, provided its own dependencies remain local. A cloud bridge or remote subscriber can still be affected by that outage.

 

For current device state, retained values can help a newly connected dashboard populate its view. Record the observation time and source identity, because “latest retained” can still mean “old”. Be particularly careful about retaining commands whose delivery to a new subscriber could trigger an action unexpectedly.

 

For backups and other required jobs, define which destination owns execution and how completion is recorded. If an audit service also needs every event, give it independent delivery state rather than adding it as another competing worker by accident.

 

Use a broker when mediated routing, independent consumers or recoverable asynchronous hand-offs justify operating it. A small application making one immediate request to one service may be simpler with a direct call. A broker adds software, configuration, permissions, monitoring and another failure domain.

 

How should you diagnose missing or repeated messages?

 

Trace one identifiable message through the relevant boundaries rather than treating “connected” as proof of delivery.

 

Boundary

Check / What success does not prove

Connection

Check: Endpoint, protocol, credentials and permissions; What success does not prove: The intended route exists

Publication

Check: Broker acceptance outcome and uncertain retries; What success does not prove: A subscriber matched

Routing

Check: Binding, filter, namespace and destination state; What success does not prove: The consumer can process the payload

Consumer delivery

Check: Receipt, subscription state and retry history; What success does not prove: The business effect committed

Application outcome

Check: Result identity, transaction and downstream state; What success does not prove: Every independent subscriber is current

 

For practical investigation:

 

  • Compare the exact published topic or routing key with the actual configured filter.

  • Separate publisher acceptance, subscriber delivery and successful application outcomes in metrics.

  • Inspect progress, age and failure state for each required destination or subscriber.

  • Check reconnect, expiry, retention and overlapping subscriptions before calling a repeat a broker defect.

  • Verify topology and permission changes alongside application releases.

 

Overlapping subscriptions deserve particular attention. Redis documents that a client subscribed through both an exact channel and a matching pattern can receive both matching deliveries. Do not assume every broker deduplicates all subscription overlap in the same way.

 

The aim is a known message reaching the required consumers and producing the intended outcomes, with explicit recovery when a boundary fails. Our networking terminology guide connects message brokers with the queueing, transport, storage and application concepts around them.

 

Frequently asked questions

 

What is a message broker in simple terms?

 

A message broker receives messages from applications and routes them to the consumers or destinations that need them. It manages that hand-off under configured routing and delivery rules, reducing the need for direct connections between every application.

 

Is a message broker the same as a queue?

 

No. The broker is the intermediary service. A queue is a mechanism or destination for holding and distributing work. A broker may support queues, independent subscriptions, retained records or several messaging patterns.

 

Does every message broker save messages for offline consumers?

 

No. Storage and offline recovery depend on the product, messaging mode, session settings and retention policy. Ephemeral publish/subscribe can lose publications for absent subscribers. A retained latest value is also different from a complete event history.

 

Does adding more subscribers share the work between them?

 

Not for ordinary independent subscriptions. Each matching subscriber may receive its own delivery. Sharing one set of jobs requires the broker's appropriate competing-consumer or shared-subscription mechanism.

 

Does exactly-once delivery guarantee exactly-once business processing?

 

No. A protocol guarantee has a defined boundary. Database changes, external API calls and notifications need appropriate identities and transaction or recovery rules to prevent harmful repeated effects.

 

Is MQTT a message broker?

 

MQTT is a messaging protocol. An MQTT broker is server software implementing its mediation and delivery behaviour. Client libraries, broker products and protocol versions are separate things to check when designing an integration.

 
 
UK Techie Broadband Providers
bottom of page