Skip to content

Deprecate container factory customizer #842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<ConcurrentPulsarListenerContainerFactory<?>>` 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<ConcurrentPulsarListenerContainerFactory<?>> containerCustomizer() {
return (containerFactory) -> containerFactory.getContainerProperties().transactions().setTimeout(Duration.ofSeconds(45));
}
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<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:

- For `@PulsarListener` register one or more PulsarContainerFactoryCustomizer<ConcurrentPulsarListenerContainerFactory<?>> beans.

- For `@PulsarReader` register one or more PulsarContainerFactoryCustomizer<DefaultPulsarReaderContainerFactory<?>> beans.

- For `@ReactivePulsarListener` register one or more PulsarContainerFactoryCustomizer<DefaultReactivePulsarListenerContainerFactory<?>> beans.


=== Deprecations
Expand All @@ -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<T extends PulsarContainerFactory<?, ?>>` that removes the need for this customizer.

Replace all instances of `ConcurrentPulsarListenerContainerFactoryCustomizer` with `org.springframework.boot.autoconfigure.pulsar.PulsarContainerFactoryCustomizer<ConcurrentPulsarListenerContainerFactoryCustomizer<?>>`.



=== Breaking Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*
* @author Chris Bono
*/
@SuppressWarnings("removal")
class ConcurrentPulsarListenerContainerFactoryBeanCustomizerPostProcessor
implements BeanPostProcessor, ApplicationContextAware {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
*
* @param <T> 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<ConcurrentPulsarListenerContainerFactory<?>>}
*/
@FunctionalInterface
@Deprecated(since = "1.2.0", forRemoval = true)
public interface ConcurrentPulsarListenerContainerFactoryCustomizer<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*
* @author Chris Bono
*/
@SuppressWarnings("removal")
class ConcurrentPulsarListenerContainerFactoryCustomizerTests {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
*
* @author Chris Bono
*/
@SuppressWarnings("removal")
class PulsarListenerTxnTests extends PulsarTxnTestsBase {

@Nested
Expand Down