Skip to content

giuseppe-trisciuoglio/developer-kit / plugins/developer-kit-java/skills/spring-boot-event-driven-patterns

spring-boot-event-driven-patterns

Verified

Provides Event-Driven Architecture (EDA) patterns for Spring Boot — creates domain events, configures ApplicationEvent and @TransactionalEventListener, sets up Kafka producers and consumers, and implements the transactional outbox pattern for reliable distributed messaging. Use when implementing event-driven systems in Spring Boot, setting up async messaging with Kafka, publishing domain events from DDD aggregates, or needing reliable event publishing with the outbox pattern.

references/configuration.md

View on GitHub
# Event-Driven Architecture Configuration

## Basic Configuration

### application.properties

```properties
# Server Configuration
server.port=8080

# Kafka Configuration
spring.kafka.bootstrap-servers=localhost:9092
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer

# Spring Cloud Stream Configuration
spring.cloud.stream.kafka.binder.brokers=localhost:9092
```

### application.yml

```yaml
server:
  port: 8080

spring:
  kafka:
    bootstrap-servers: localhost:9092
    producer:
      key-serializer: org.apache.kafka.common.serialization.StringSerializer
      value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
    consumer:
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
      properties:
        spring.json.trusted.packages: "*"

  cloud:
    stream:
      kafka:
        binder:
          brokers: localhost:9092
      bindings:
        productCreated-in-0:
          destination: product-events
          group: order-service
```

## Advanced Configuration

### Kafka Producer Configuration

```yaml
spring:
  kafka:
    producer:
      acks: all
      retries: 3
      properties:
        retry.backoff.ms: 1000
      enable.idempotence: true
      compression-type: snappy
```

### Kafka Consumer Configuration

```yaml
spring:
  kafka:
    consumer:
      auto-offset-reset: earliest
      enable-auto-commit: false
      max-poll-records: 100
    listener:
      ack-mode: manual_immediate
```

### Error Handling Configuration

```yaml
spring:
  kafka:
    producer:
      properties:
        retries: 3
        retry.backoff.ms: 1000
    consumer:
      properties:
        max.poll.interval.ms: 300000
```

## Spring Cloud Stream Bindings

### Producer Binding

```yaml
spring:
  cloud:
    stream:
      bindings:
        productCreated-out-0:
          destination: product-events
          producer:
            partition-count: 3
```

### Consumer Binding

```yaml
spring:
  cloud:
    stream:
      bindings:
        productCreated-in-0:
          destination: product-events
          group: order-service
          consumer:
            max-attempts: 3
            back-off-initial-interval: 1000
```

## Environment-Specific Configuration

### Development

```yaml
spring:
  kafka:
    bootstrap-servers: localhost:9092
```

### Production

```yaml
spring:
  kafka:
    bootstrap-servers: kafka1.prod.example.com:9092,kafka2.prod.example.com:9092,kafka3.prod.example.com:9092
    properties:
      security.protocol: SSL
      ssl.truststore.location: /etc/kafka/truststore.jks
      ssl.keystore.location: /etc/kafka/keystore.jks
```
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall