Przejdź do treści
Biblioteka skilli
Programowanie · Integracja z narzędziem

spring-amqp

/spring-amqp

Integruje Spring AMQP z RabbitMQ przez RabbitTemplate i @RabbitListener: wymiany, kolejki, bindingi, DLQ i konwersja wiadomości.

Licencja
MIT
Ostatnia zmiana repozytorium
21.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 21.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Integruje Spring AMQP z RabbitMQ przez RabbitTemplate i @RabbitListener: wymiany, kolejki, bindingi, DLQ i konwersja wiadomości.

Wyzwalacze z opisu

spring amqpRabbitTemplate@RabbitListenerRabbitMQ SpringAMQPmessage queue Spring Boot
Oryginalny opis (EN)

Spring AMQP for RabbitMQ integration with RabbitTemplate and @RabbitListener. Covers exchanges, queues, bindings, DLQ, and message conversion. USE WHEN: user mentions "spring amqp", "RabbitTemplate", "@RabbitListener", "RabbitMQ Spring", "AMQP", "message queue Spring Boot" DO NOT USE FOR: raw RabbitMQ - use `rabbitmq` skill, Kafka - use `spring-kafka` skill, generic messaging patterns - use `messaging-expert`

Jak działa

  1. Dependencies
  2. Configuration
  3. Exchange, Queue, Binding Setup
  4. Producer
  5. Consumer
  6. Best Practices
  7. When NOT to Use This Skill
  8. Anti-Patterns
  9. Quick Troubleshooting
  10. Production Checklist
Sekcje z nagłówków SKILL.md, w oryginale · 165 linii, 534 słów
Podgląd SKILL.md
---
name: spring-amqp
description: |
  Spring AMQP for RabbitMQ integration with RabbitTemplate and @RabbitListener.
  Covers exchanges, queues, bindings, DLQ, and message conversion.

  USE WHEN: user mentions "spring amqp", "RabbitTemplate", "@RabbitListener",
  "RabbitMQ Spring", "AMQP", "message queue Spring Boot"

  DO NOT USE FOR: raw RabbitMQ - use `rabbitmq` skill,
  Kafka - use `spring-kafka` skill, generic messaging patterns - use `messaging-expert`
allowed-tools: Read, Grep, Glob, Write, Edit
---
# Spring AMQP (RabbitMQ) - Quick Reference

> **Full Reference**: See [advanced.md](advanced.md) for exchange types (topic, fanout), consumer patterns (multi-method, request-reply), error handling, DLQ processing, and testing.

> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `rabbitmq` for comprehensive documentation.

## Dependencies

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

## Configuration

```yaml
spring:
  rabbitmq:
    host: localhost
    port: 5672
    username: guest
    password: guest
    listener:
      simple:
        acknowledge-mode: manual
        concurrency: 3
        max-concurrency: 10
        prefetch: 10
```

## Exchange, Queue, Binding Setup

```java
@Configuration
public class RabbitMQConfig {

    public static final String EXCHANGE = "orders.exchange";
    public static final String QUEUE = "orders.queue";
    public static final String ROUTING_KEY = "orders.created";

    @Bean
    public DirectExchange ordersExchange() {
        return new DirectExchange(EXCHANGE);
    }

    @Bean
    public Queue ordersQueue() {
        return QueueBuilder.durable(QUEUE)
            .withArgument("x-dead-letter-exchange", "orders.dlx")
            .withArgument("x-dead-letter-routing-key", "dead")
            .build();
    }

    @Bean
    public Binding ordersBinding() {
        return BindingBuilder.bind(ordersQueue()).to(ordersExchange()).with(ROUTING_KEY);
    }

    @Bean
    public Jackson2JsonMessageConverter messageConverter() {
        return new Jackson2JsonMessageConverter();
    }
}
```

## Producer

```java
@Service
@RequiredArgsConstructor
public class OrderProducer {

    private final RabbitTemplate rabbitTemplate;

    public void sendOrder(OrderEvent event) {
        rabbitTemplate.convertAndSend(EXCHANGE, ROUTING_KEY, event);
    }

    public void sendWithHeaders(OrderEvent event, String correlationId) {
        rabbitTemplate.convertAndSend(EXCHANGE, ROUTING_KEY, event, message -> {
            message.getMessageProperties().setCorrelationId(correlationId);
            message.getMessageProperties().setDeliveryMode(MessageDeliveryMode.PERSISTENT);
            return message;
        });
    }
}
```

## Consumer

```java
@Service
public class OrderConsumer {

    @RabbitListener(queues = "orders.queue")
    public void consume(
            @Payload OrderEvent event,
            @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag,
            @Header(AmqpHeaders.CORRELATION_ID) String correlationId,
            Channel channel) throws IOException {

        try {
            processOrder(event);
            channel.basicAck(deliveryTag, false);
        } catch (Exception e) {
            channel.basicNack(deliveryTag, false, false); // Send to DLQ
        }
    }
}
```

## Best Practices

| Do | Don't |
|----|-------|
| Use manual acknowledgment | Auto-ack without processing |
| Configure DLX/DLQ | Silently lose failed messages |
| Set message TTL | Keep messages forever |
| Use persistent delivery | Transient for important messages |
| Configure prefetch | Unbounded prefetch |

## When NOT to Use This Skill

- **Raw RabbitMQ** - Use `rabbitmq` skill for server configuration
- **Kafka integration** - Use `spring-kafka` skill
- **Generic messaging patterns** - Consult `messaging-expert`

## Anti-Patterns

| Anti-Pattern | Problem | Solution |
|--------------|---------|----------|
| Auto-ack without processing | Message loss | Use manual acknowledgment |
| No DLQ configured | Lost failed messages | Configure dead letter exchange |
| Unbounded prefetch | Memory issues | Set appropriate prefetch count |
| Blocking in listener | Thread exhaustion | Use async processing |
| No retry policy | Temporary failures cause loss | Configure retry with backoff |

## Quick Troubleshooting

| Problem | Diagnostic | Fix |
|---------|------------|-----|
| Connection refused | Check RabbitMQ running | Verify host/port |
| Message not consumed | Check queue binding | Verify routing key |
| Messages in DLQ | Check x-death header | Fix processing error |
| Consumer not starting | Check @RabbitListener | Verify queue exists |
| Serialization error | Check message type | Configure Jackson converter |

## Production Checklist

- [ ] Connection factory configured
- [ ] Manual acknowledgment mode
- [ ] DLX/DLQ configured
- [ ] Retry policy set
- [ ] Message converter configured
- [ ] Publisher confirms enabled
- [ ] Prefetch count optimized
- [ ] Error handler implemented
- [ ] Message TTL set
- [ ] Monitoring enabled

## Reference Documentation
- [Spring AMQP Reference](https://docs.spring.io/spring-amqp/reference/)
Pliki w paczce (2)
  • SKILL.md 5 KB
  • advanced.md 8 KB

Wersje

W bazie nie ma innych skilli o nazwie spring-amqp.

Migawka bazy z 13.11.2026 · wersja paczki ed56101402d3 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 95messaging-testing-rabbitmq
    Prowadzi testy integracyjne RabbitMQ z użyciem @SpringRabbitTest, RabbitListenerTestHarness, TestRabbitTemplate i Testcontainers w Java/Spring, Node.js i Pythonie.
  • 100spring-kafka
    Integruje Spring Boot z Apache Kafka przez KafkaTemplate i @KafkaListener: producenci, konsumenci, retry topics, DLT i transakcje.
  • 100rabbitmq-tests
    Testuje producentów i konsumentów RabbitMQ we wzorcach AMQP 0.9.1 i 1.0, z potwierdzeniami, trwałymi kolejkami i Testcontainers.
  • 100messaging-patterns
    Projektuje zdarzeniową wymianę wiadomości w Spring Boot 4.x: producentów i konsumentów Kafki lub RabbitMQ, outbox, idempotentnych konsumentów i testy Testcontainers.
  • 100asyncapi-typescript
    Generuje typy TypeScript, helpery dispatch, powiązania AMQP i adaptery frameworków ze specyfikacji AsyncAPI 3.0 przez @ir-kit/asyncapi-typescript, dla RabbitMQ, Kafka i NATS.
  • 100rabbitmq-message-queues-and-routing
    Projektuje wysoko dostępne systemy RabbitMQ: topologie exchange'ów, wzorce AMQP, strojenie prefetch, publisher confirms, potwierdzenia konsumentów, Quorum Queues i dead-lettering.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.