or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

actuator.mdconfiguration.mdcore-messaging.mdindex.mdlisteners.mdstreams.md
tile.json

tessl/maven-org-springframework-boot--spring-boot-starter-amqp

Spring Boot starter for AMQP messaging with RabbitMQ including auto-configuration, connection management, and message processing capabilities

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.springframework.boot/spring-boot-starter-amqp@3.5.x

To install, run

npx @tessl/cli install tessl/maven-org-springframework-boot--spring-boot-starter-amqp@3.5.0

index.mddocs/

Spring Boot AMQP Starter

Spring Boot AMQP Starter provides comprehensive auto-configuration for AMQP (Advanced Message Queuing Protocol) messaging with RabbitMQ. It automatically configures connection factories, rabbit templates, message listeners, and administrative components for robust message-driven applications.

Package Information

  • Package Name: org.springframework.boot:spring-boot-starter-amqp
  • Package Type: Maven
  • Language: Java
  • Installation: Add to your Maven pom.xml or Gradle build.gradle:

Maven:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-amqp</artifactId>
</dependency>

Gradle:

implementation 'org.springframework.boot:spring-boot-starter-amqp'

Core Imports

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.core.RabbitMessagingTemplate;
import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.boot.autoconfigure.amqp.RabbitProperties;
import org.springframework.boot.autoconfigure.amqp.ConnectionFactoryCustomizer;
import org.springframework.boot.autoconfigure.amqp.RabbitTemplateCustomizer;

Basic Usage

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MessageService {
    
    @Autowired
    private RabbitTemplate rabbitTemplate;
    
    // Send messages
    public void sendMessage(String routingKey, Object message) {
        rabbitTemplate.convertAndSend(routingKey, message);
    }
    
    // Receive messages
    @RabbitListener(queues = "myQueue")
    public void handleMessage(String message) {
        System.out.println("Received: " + message);
    }
}

Architecture

Spring Boot AMQP Starter is built around several key auto-configuration components:

  • Connection Management: Automatically configures CachingConnectionFactory with connection pooling and SSL support
  • Message Operations: Provides RabbitTemplate and RabbitMessagingTemplate for sending/receiving messages
  • Administrative Operations: Auto-configures AmqpAdmin for queue, exchange, and binding management
  • Listener Infrastructure: Sets up listener container factories for annotation-driven message consumption
  • Property Configuration: Centralizes all RabbitMQ settings under spring.rabbitmq prefix
  • Actuator Integration: Includes health indicators and metrics collection for monitoring

Capabilities

Core Messaging

Primary messaging operations using RabbitTemplate and administrative functions through AmqpAdmin. Essential for sending messages, managing queues, and basic RabbitMQ operations.

// Auto-configured beans available for injection
@Autowired RabbitTemplate rabbitTemplate;
@Autowired AmqpAdmin amqpAdmin;
@Autowired RabbitMessagingTemplate rabbitMessagingTemplate;

Core Messaging

Configuration Properties

Comprehensive configuration options for RabbitMQ connections, caching, SSL, timeouts, and message handling behavior through spring.rabbitmq properties.

@ConfigurationProperties("spring.rabbitmq")
public class RabbitProperties {
    private String host = "localhost";
    private Integer port;
    private String username = "guest";
    private String password = "guest";
    // ... many more properties
}

Configuration Properties

Message Listeners

Annotation-driven message consumption using @RabbitListener with auto-configured listener container factories for both simple and direct listening modes.

@RabbitListener(queues = "queueName")
public void handleMessage(String message) { }

@RabbitListener(bindings = @QueueBinding(
    value = @Queue("myQueue"),
    exchange = @Exchange("myExchange"),
    key = "routing.key"
))
public void handleMessage(MyObject message) { }

Message Listeners

Actuator Integration

Health monitoring and metrics collection for RabbitMQ connections through Spring Boot Actuator endpoints, providing operational visibility into messaging infrastructure.

// Auto-configured health indicator
HealthContributor rabbitHealthContributor;

// Auto-configured metrics
RabbitConnectionFactoryMetricsPostProcessor metricsPostProcessor;

Actuator Integration

Stream Support

Auto-configuration for RabbitMQ Streams, a new persistent messaging protocol that provides high-throughput, persistent message streaming capabilities.

// Auto-configured when RabbitMQ Stream dependencies are available
RabbitStreamTemplate rabbitStreamTemplate;

Stream Support