Class JpaDeadLetterQueueAutoConfiguration

java.lang.Object
org.axonframework.extension.springboot.autoconfig.JpaDeadLetterQueueAutoConfiguration

@AutoConfiguration(after={JpaAutoConfiguration.class,ConverterAutoConfiguration.class}) @ConditionalOnClass(jakarta.persistence.EntityManagerFactory.class) @ConditionalOnBean(jakarta.persistence.EntityManagerFactory.class) public class JpaDeadLetterQueueAutoConfiguration extends Object
Spring Boot autoconfiguration that registers a JPA-backed SequencedDeadLetterQueueFactory bean.

This configuration activates when a EntityManagerFactory bean is present (i.e. JPA is on the classpath and configured). The registered factory creates a JpaSequencedDeadLetterQueue instance per event handling component, using the application's EntityManagerFactory, EventConverter, and Converter. Each queue is scoped by a component-level processing group identifier (e.g. "DeadLetterQueue[myProcessor][0]").

To enable Dead Letter Queue processing for a specific processor, set:


 axon.eventhandling.processors.<processorName>.dlq.enabled=true
 

The cache size used for sequence identifier caching can be tuned per processor:


 axon.eventhandling.processors.<processorName>.dlq.cache.size=2048
 

To replace the default JPA factory with a custom backend, declare your own SequencedDeadLetterQueueFactory bean — the @ConditionalOnMissingBean guard on the default will yield to it.

Since:
5.1.0
Author:
Mateusz Nowak
See Also:
  • Constructor Details

    • JpaDeadLetterQueueAutoConfiguration

      public JpaDeadLetterQueueAutoConfiguration()
  • Method Details

    • jpaDeadLetterQueueFactory

      @Bean @ConditionalOnMissingBean public SequencedDeadLetterQueueFactory jpaDeadLetterQueueFactory(jakarta.persistence.EntityManagerFactory entityManagerFactory, EventConverter eventConverter, Converter genericConverter)
      Creates a JPA-backed SequencedDeadLetterQueueFactory that instantiates a JpaSequencedDeadLetterQueue per event handling component.

      The processingGroup passed to the factory is a component-scoped identifier following the pattern "DeadLetterQueue[processorName][componentName]", used to scope dead letters in the database. The configuration parameter is ignored in this Spring implementation since all dependencies are wired via Spring bean injection.

      Parameters:
      entityManagerFactory - The JPA EntityManagerFactory used for persistence.
      eventConverter - The EventConverter used to convert event payloads and metadata.
      genericConverter - The generic Converter used for type conversion.
      Returns:
      A SequencedDeadLetterQueueFactory backed by JPA.