liveBook · Manning

Message broker

As explained in Spring in Action, Sixth Edition

A message broker is middleware that accepts, routes, and delivers messages between application components or services.

A message broker is middleware that relays messages between application components. Producers send messages to queues or topics; consumers receive them asynchronously, creating looser coupling and supporting scalability. section 9.1 section 9.4

In Java applications, JMS provides a common API for working with different brokers. Spring builds on it with JmsTemplate for sending and receiving messages and message-driven POJOs for reacting to arrivals. section 9.1 section 9.1

A Spring application can interact with a broker through:

  • JmsTemplate, RabbitTemplate, or KafkaTemplate for template-based message sending and pull-based receiving. section 9.4
  • Message listener annotations such as @JmsListener, @RabbitListener, or @KafkaListener for pushed delivery to consumer methods. section 9.4
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-artemis</artifactId>
</dependency>

Add the Spring Boot Artemis starter to a project before connecting JMS code to an Artemis broker. section 9.1.1

Artemis is the recommended choice here over legacy ActiveMQ, although application code changes little between them. Development uses localhost:61616 by default; production configuration supplies the broker host, port, and optional credentials. section 9.1.1 section 9.1.1

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains broker roles, JMS abstractions, client setup, and connection properties without descending into broker internals.
Examples
Uses Artemis and ActiveMQ dependencies, localhost development settings, and production YAML for an authenticated Artemis endpoint.
What it assumes
Assumes Java and Spring Boot project setup while introducing JMS, broker clients, queues, topics, and asynchronous consumption.
What you can do after
Operate/configure a Spring JMS application by selecting a broker, adding its starter, and setting connection properties.
How it connects
Connects message brokers with JMS, asynchronous messaging, queues, topics, message consumers, and message listener annotations.

Also explained in

Compare how 3 books explain message broker →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.