Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/spring-projects/spring-boot/llms.txt

Use this file to discover all available pages before exploring further.

Spring Boot messaging starters integrate mature message brokers and communication protocols into your application with minimal configuration. Whether you need fire-and-forget event streams, request-reply messaging, or real-time bidirectional connections, there is a starter that wires up the right client, template, and listener container automatically.

Choosing a messaging technology

For high-throughput, append-only, replay-capable event streams, use Apache Kafka or Apache Pulsar. Both provide persistent, partitioned logs that multiple consumers can read independently.

spring-boot-starter-amqp

AMQP messaging with RabbitMQ via Spring AMQP. Auto-configures RabbitTemplate, RabbitAdmin, and a SimpleMessageListenerContainer. Includes: spring-boot-starter · spring-boot-amqp
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
Configure the broker connection:
application.properties
spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
A minimal producer and listener:
// Producer
@Service
public class OrderPublisher {

    private final RabbitTemplate rabbitTemplate;

    public OrderPublisher(RabbitTemplate rabbitTemplate) {
        this.rabbitTemplate = rabbitTemplate;
    }

    public void publish(Order order) {
        rabbitTemplate.convertAndSend("orders.exchange", "orders.created", order);
    }
}

// Consumer
@Component
public class OrderListener {

    @RabbitListener(queues = "orders.queue")
    public void handle(Order order) {
        // process the order
    }
}
When to use: Publish-subscribe fanout, topic-based routing, dead-letter queues, or request-reply messaging patterns. RabbitMQ’s broker-side routing model suits workloads where the routing logic should live in infrastructure rather than application code.

spring-boot-starter-kafka

Apache Kafka integration via Spring for Apache Kafka. Auto-configures KafkaTemplate, a ConsumerFactory, and @KafkaListener support. Includes: spring-boot-starter · spring-boot-kafka
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-kafka</artifactId>
</dependency>
application.properties
spring.kafka.bootstrap-servers=localhost:9092
spring.kafka.consumer.group-id=my-app
spring.kafka.consumer.auto-offset-reset=earliest
Send and receive messages:
// Producer
@Service
public class EventPublisher {

    private final KafkaTemplate<String, String> kafkaTemplate;

    public EventPublisher(KafkaTemplate<String, String> kafkaTemplate) {
        this.kafkaTemplate = kafkaTemplate;
    }

    public void send(String topic, String event) {
        kafkaTemplate.send(topic, event);
    }
}

// Consumer
@Component
public class EventConsumer {

    @KafkaListener(topics = "user-events")
    public void consume(String message) {
        // process the event
    }
}
When to use: High-throughput event streaming, event sourcing, change-data capture (CDC) pipelines, or any workload where you need replay, partitioned parallelism, or long-term log retention.

spring-boot-starter-pulsar

Apache Pulsar integration via Spring for Apache Pulsar. Auto-configures PulsarTemplate and @PulsarListener support. Includes: spring-boot-starter · spring-boot-pulsar
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-pulsar</artifactId>
</dependency>
application.properties
spring.pulsar.client.service-url=pulsar://localhost:6650
// Producer
@Service
public class NotificationSender {

    private final PulsarTemplate<String> pulsarTemplate;

    public NotificationSender(PulsarTemplate<String> pulsarTemplate) {
        this.pulsarTemplate = pulsarTemplate;
    }

    public void send(String notification) throws PulsarClientException {
        pulsarTemplate.send("notifications", notification);
    }
}

// Consumer
@Component
public class NotificationConsumer {

    @PulsarListener(topics = "notifications")
    public void receive(String notification) {
        // process the notification
    }
}
When to use: Multi-tenancy, geo-replication, or tiered storage requirements that go beyond what Kafka provides out of the box.

JMS starters

JMS (Jakarta Messaging) is a standard API for message queuing. The base spring-boot-starter-jms starter provides the Spring JMS integration; pair it with a broker-specific starter.

spring-boot-starter-jms

The core JMS starter. Auto-configures JmsTemplate and @JmsListener support. Includes: spring-boot-starter · spring-boot-jms
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jms</artifactId>
</dependency>

spring-boot-starter-activemq

JMS with Apache ActiveMQ Classic. Includes the Spring JMS integration and the ActiveMQ client. Includes: spring-boot-starter · spring-boot-activemq · spring-boot-jms
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
application.properties
spring.activemq.broker-url=tcp://localhost:61616
spring.activemq.user=admin
spring.activemq.password=admin

spring-boot-starter-artemis

JMS with Apache Artemis (the next-generation ActiveMQ broker with NIO transport and high availability). Includes: spring-boot-starter · spring-boot-artemis · spring-boot-jms
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-artemis</artifactId>
</dependency>
application.properties
spring.artemis.mode=native
spring.artemis.host=localhost
spring.artemis.port=61616
spring.artemis.user=admin
spring.artemis.password=admin
Artemis supports an embedded broker mode (spring.artemis.mode=embedded) that starts a broker in-process — useful for testing without a separate broker process.

spring-boot-starter-integration

Spring Integration: message-driven architectures using channels, endpoints, transformers, routers, and adapters for connecting disparate systems. Includes: spring-boot-starter · spring-boot-integration
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-integration</artifactId>
</dependency>
When to use: Enterprise Integration Patterns (EIP) — file polling, FTP, HTTP, JMS, and AMQP adapters — or building integration flows declaratively with the Java DSL.
@Bean
public IntegrationFlow fileReadingFlow() {
    return IntegrationFlow
        .from(Files.inboundAdapter(new File("/data/in"))
                   .autoCreateDirectory(true),
              e -> e.poller(Pollers.fixedDelay(5000)))
        .transform(Files.toStringTransformer())
        .channel("processedChannel")
        .get();
}

spring-boot-starter-rsocket

RSocket protocol support via Spring Framework’s RSocket integration. RSocket is a binary, multiplexed, reactive application protocol over TCP or WebSocket. Includes: spring-boot-starter · spring-boot-starter-jackson · spring-boot-starter-reactor-netty · spring-boot-reactor · spring-boot-rsocket · rsocket-transport-netty · jackson-dataformat-cbor
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-rsocket</artifactId>
</dependency>
RSocket supports four interaction models: request-response, fire-and-forget, request-stream, and channel (bidirectional stream).
@Controller
public class StockController {

    @MessageMapping("stock.{ticker}")
    public Flux<StockPrice> streamPrices(@DestinationVariable String ticker) {
        return stockService.streamPrices(ticker);
    }
}
When to use: Service-to-service communication that needs reactive, backpressure-aware, bidirectional streaming — for example, live metric feeds between microservices.

spring-boot-starter-websocket

Spring MVC WebSocket support with STOMP messaging over WebSocket. Includes: spring-boot-starter · spring-boot-starter-webmvc · spring-boot-websocket
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
Configure a STOMP message broker endpoint:
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/ws").withSockJS();
    }

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
        registry.enableSimpleBroker("/topic");
        registry.setApplicationDestinationPrefixes("/app");
    }
}
When to use: Browser-to-server real-time features such as chat, notifications, collaborative editing, or live score updates where clients are web browsers using SockJS/STOMP.
This starter is listed under both web and messaging sections because it serves both purposes. For pure service-to-service bidirectional streaming, RSocket is often a better fit.

Build docs developers (and LLMs) love