Skip to content

Commit 27c9747

Browse files
authored
Deprecate container factory customizer (#842)
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 `PulsarContainerFactoryCustomizer` that removes the need for this customizer. This commit deprecates the Spring for Apache Pulsar customizer in favor of the Spring Boot provided generic container factory customizer.
1 parent 8ed6689 commit 27c9747

File tree

6 files changed

+23
-2
lines changed

6 files changed

+23
-2
lines changed

spring-pulsar-docs/src/main/antora/modules/ROOT/pages/reference/pulsar/transactions.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ These settings affect all listener containers, including the ones used by `@Puls
138138

139139
When not using Spring Boot, you can adjust these settings on the container factory that you provide.
140140
However, when using Spring Boot, the container factory is auto-configured.
141-
In this case you can register a `ConcurrentPulsarListenerContainerFactoryCustomizer` bean to access and customize the container properties.
141+
In this case you can register a `org.springframework.boot.autoconfigure.pulsar.PulsarContainerFactoryCustomizer<ConcurrentPulsarListenerContainerFactory<?>>` bean to access and customize the container properties.
142142
The following example shows how to set the timeout on the container factory:
143143

144144
[source, java]
145145
----
146146
@Bean
147-
ConcurrentPulsarListenerContainerFactoryCustomizer<?> containerCustomizer() {
147+
PulsarContainerFactoryCustomizer<ConcurrentPulsarListenerContainerFactory<?>> containerCustomizer() {
148148
return (containerFactory) -> containerFactory.getContainerProperties().transactions().setTimeout(Duration.ofSeconds(45));
149149
}
150150
----

spring-pulsar-docs/src/main/antora/modules/ROOT/pages/whats-new.adoc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ See xref:./reference/default-tenant-namespace.adoc[Default Tenant / Namespace] f
1818
You can now configure the message listener container startup failure policy to `stop`, `continue`, or `retry`.
1919
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]
2020

21+
=== Message Container Factory Customizers (Spring Boot)
22+
Spring Boot has introduced a generic message container factory customizer `org.springframework.boot.autoconfigure.pulsar.PulsarContainerFactoryCustomizer<T extends PulsarContainerFactory<?, ?>>` that can be used to further configure one or more of the auto-configured container factories that back the following listener annotations:
23+
24+
- For `@PulsarListener` register one or more PulsarContainerFactoryCustomizer<ConcurrentPulsarListenerContainerFactory<?>> beans.
25+
26+
- For `@PulsarReader` register one or more PulsarContainerFactoryCustomizer<DefaultPulsarReaderContainerFactory<?>> beans.
27+
28+
- For `@ReactivePulsarListener` register one or more PulsarContainerFactoryCustomizer<DefaultReactivePulsarListenerContainerFactory<?>> beans.
2129

2230

2331
=== Deprecations
@@ -40,6 +48,13 @@ As part of this, the following APIs were deprecated, copied, and renamed:
4048

4149
- `ReaderContainerFactory#createReaderContainer(String... topics)` replaced with `ReaderContainerFactory#createContainer`
4250

51+
==== ConcurrentPulsarListenerContainerFactoryCustomizer
52+
The purpose of `ConcurrentPulsarListenerContainerFactoryCustomizer` was to customize the Spring Boot auto-configured message container factories.
53+
However, Spring Boot has introduced a generic message container factory customizer `org.springframework.boot.autoconfigure.pulsar.PulsarContainerFactoryCustomizer<T extends PulsarContainerFactory<?, ?>>` that removes the need for this customizer.
54+
55+
Replace all instances of `ConcurrentPulsarListenerContainerFactoryCustomizer` with `org.springframework.boot.autoconfigure.pulsar.PulsarContainerFactoryCustomizer<ConcurrentPulsarListenerContainerFactoryCustomizer<?>>`.
56+
57+
4358

4459
=== Breaking Changes
4560

spring-pulsar/src/main/java/org/springframework/pulsar/annotation/ConcurrentPulsarListenerContainerFactoryBeanCustomizerPostProcessor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
*
3535
* @author Chris Bono
3636
*/
37+
@SuppressWarnings("removal")
3738
class ConcurrentPulsarListenerContainerFactoryBeanCustomizerPostProcessor
3839
implements BeanPostProcessor, ApplicationContextAware {
3940

spring-pulsar/src/main/java/org/springframework/pulsar/config/ConcurrentPulsarListenerContainerFactoryCustomizer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
*
2323
* @param <T> The message payload type
2424
* @author Chris Bono
25+
* @deprecated since 1.2.0 for removal in 1.4.0 in favor of
26+
* {@code org.springframework.boot.autoconfigure.pulsar.PulsarContainerFactoryCustomizer<ConcurrentPulsarListenerContainerFactory<?>>}
2527
*/
2628
@FunctionalInterface
29+
@Deprecated(since = "1.2.0", forRemoval = true)
2730
public interface ConcurrentPulsarListenerContainerFactoryCustomizer<T> {
2831

2932
/**

spring-pulsar/src/test/java/org/springframework/pulsar/listener/ConcurrentPulsarListenerContainerFactoryCustomizerTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
*
3737
* @author Chris Bono
3838
*/
39+
@SuppressWarnings("removal")
3940
class ConcurrentPulsarListenerContainerFactoryCustomizerTests {
4041

4142
@Test

spring-pulsar/src/test/java/org/springframework/pulsar/listener/PulsarListenerTxnTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
*
5252
* @author Chris Bono
5353
*/
54+
@SuppressWarnings("removal")
5455
class PulsarListenerTxnTests extends PulsarTxnTestsBase {
5556

5657
@Nested

0 commit comments

Comments
 (0)