diff --git a/spring-pulsar-docs/src/main/antora/modules/ROOT/pages/reference/pulsar/transactions.adoc b/spring-pulsar-docs/src/main/antora/modules/ROOT/pages/reference/pulsar/transactions.adoc index fb123c9e..d3baa783 100644 --- a/spring-pulsar-docs/src/main/antora/modules/ROOT/pages/reference/pulsar/transactions.adoc +++ b/spring-pulsar-docs/src/main/antora/modules/ROOT/pages/reference/pulsar/transactions.adoc @@ -138,13 +138,13 @@ These settings affect all listener containers, including the ones used by `@Puls When not using Spring Boot, you can adjust these settings on the container factory that you provide. However, when using Spring Boot, the container factory is auto-configured. -In this case you can register a `ConcurrentPulsarListenerContainerFactoryCustomizer` bean to access and customize the container properties. +In this case you can register a `org.springframework.boot.autoconfigure.pulsar.PulsarContainerFactoryCustomizer>` bean to access and customize the container properties. The following example shows how to set the timeout on the container factory: [source, java] ---- @Bean -ConcurrentPulsarListenerContainerFactoryCustomizer containerCustomizer() { +PulsarContainerFactoryCustomizer> containerCustomizer() { return (containerFactory) -> containerFactory.getContainerProperties().transactions().setTimeout(Duration.ofSeconds(45)); } ---- diff --git a/spring-pulsar-docs/src/main/antora/modules/ROOT/pages/whats-new.adoc b/spring-pulsar-docs/src/main/antora/modules/ROOT/pages/whats-new.adoc index d195644c..163b1bc4 100644 --- a/spring-pulsar-docs/src/main/antora/modules/ROOT/pages/whats-new.adoc +++ b/spring-pulsar-docs/src/main/antora/modules/ROOT/pages/whats-new.adoc @@ -18,6 +18,14 @@ See xref:./reference/default-tenant-namespace.adoc[Default Tenant / Namespace] f You can now configure the message listener container startup failure policy to `stop`, `continue`, or `retry`. For more details see the corresponding section for one of the supported containers xref:./reference/pulsar/message-consumption.adoc#message-listener-startup-failure[@PulsarListener], xref:./reference/pulsar/message-consumption.adoc#message-reader-startup-failure[@PulsarReader], or xref:./reference/reactive-pulsar/reactive-message-consumption.adoc#message-listener-startup-failure[@ReactivePulsarListener] +=== Message Container Factory Customizers (Spring Boot) +Spring Boot has introduced a generic message container factory customizer `org.springframework.boot.autoconfigure.pulsar.PulsarContainerFactoryCustomizer>` that can be used to further configure one or more of the auto-configured container factories that back the following listener annotations: + +- For `@PulsarListener` register one or more PulsarContainerFactoryCustomizer> beans. + +- For `@PulsarReader` register one or more PulsarContainerFactoryCustomizer> beans. + +- For `@ReactivePulsarListener` register one or more PulsarContainerFactoryCustomizer> beans. === Deprecations @@ -40,6 +48,13 @@ As part of this, the following APIs were deprecated, copied, and renamed: - `ReaderContainerFactory#createReaderContainer(String... topics)` replaced with `ReaderContainerFactory#createContainer` +==== ConcurrentPulsarListenerContainerFactoryCustomizer +The purpose of `ConcurrentPulsarListenerContainerFactoryCustomizer` was to customize the Spring Boot auto-configured message container factories. +However, Spring Boot has introduced a generic message container factory customizer `org.springframework.boot.autoconfigure.pulsar.PulsarContainerFactoryCustomizer>` that removes the need for this customizer. + +Replace all instances of `ConcurrentPulsarListenerContainerFactoryCustomizer` with `org.springframework.boot.autoconfigure.pulsar.PulsarContainerFactoryCustomizer>`. + + === Breaking Changes diff --git a/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/ConcurrentPulsarListenerContainerFactoryBeanCustomizerPostProcessor.java b/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/ConcurrentPulsarListenerContainerFactoryBeanCustomizerPostProcessor.java index 73041a51..69c2eba5 100644 --- a/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/ConcurrentPulsarListenerContainerFactoryBeanCustomizerPostProcessor.java +++ b/spring-pulsar/src/main/java/org/springframework/pulsar/annotation/ConcurrentPulsarListenerContainerFactoryBeanCustomizerPostProcessor.java @@ -34,6 +34,7 @@ * * @author Chris Bono */ +@SuppressWarnings("removal") class ConcurrentPulsarListenerContainerFactoryBeanCustomizerPostProcessor implements BeanPostProcessor, ApplicationContextAware { diff --git a/spring-pulsar/src/main/java/org/springframework/pulsar/config/ConcurrentPulsarListenerContainerFactoryCustomizer.java b/spring-pulsar/src/main/java/org/springframework/pulsar/config/ConcurrentPulsarListenerContainerFactoryCustomizer.java index 3c389076..a1e56303 100644 --- a/spring-pulsar/src/main/java/org/springframework/pulsar/config/ConcurrentPulsarListenerContainerFactoryCustomizer.java +++ b/spring-pulsar/src/main/java/org/springframework/pulsar/config/ConcurrentPulsarListenerContainerFactoryCustomizer.java @@ -22,8 +22,11 @@ * * @param The message payload type * @author Chris Bono + * @deprecated since 1.2.0 for removal in 1.4.0 in favor of + * {@code org.springframework.boot.autoconfigure.pulsar.PulsarContainerFactoryCustomizer>} */ @FunctionalInterface +@Deprecated(since = "1.2.0", forRemoval = true) public interface ConcurrentPulsarListenerContainerFactoryCustomizer { /** diff --git a/spring-pulsar/src/test/java/org/springframework/pulsar/listener/ConcurrentPulsarListenerContainerFactoryCustomizerTests.java b/spring-pulsar/src/test/java/org/springframework/pulsar/listener/ConcurrentPulsarListenerContainerFactoryCustomizerTests.java index dec1a7e9..b3252401 100644 --- a/spring-pulsar/src/test/java/org/springframework/pulsar/listener/ConcurrentPulsarListenerContainerFactoryCustomizerTests.java +++ b/spring-pulsar/src/test/java/org/springframework/pulsar/listener/ConcurrentPulsarListenerContainerFactoryCustomizerTests.java @@ -36,6 +36,7 @@ * * @author Chris Bono */ +@SuppressWarnings("removal") class ConcurrentPulsarListenerContainerFactoryCustomizerTests { @Test diff --git a/spring-pulsar/src/test/java/org/springframework/pulsar/listener/PulsarListenerTxnTests.java b/spring-pulsar/src/test/java/org/springframework/pulsar/listener/PulsarListenerTxnTests.java index a73f500c..f0405e4b 100644 --- a/spring-pulsar/src/test/java/org/springframework/pulsar/listener/PulsarListenerTxnTests.java +++ b/spring-pulsar/src/test/java/org/springframework/pulsar/listener/PulsarListenerTxnTests.java @@ -51,6 +51,7 @@ * * @author Chris Bono */ +@SuppressWarnings("removal") class PulsarListenerTxnTests extends PulsarTxnTestsBase { @Nested