diff --git a/spring-pulsar-dependencies/build.gradle b/spring-pulsar-dependencies/build.gradle index bd765e38..bb123005 100644 --- a/spring-pulsar-dependencies/build.gradle +++ b/spring-pulsar-dependencies/build.gradle @@ -21,10 +21,10 @@ ext { protobufJavaVersion = '3.21.5' pulsarTestcontainersVersion = '1.17.3' pulsarVersion = '2.10.1' - reactorVersion = '2020.0.17' - springBootVersion = '3.0.0-SNAPSHOT' + reactorVersion = '2022.0.0-M4' + springBootVersion = '3.0.0-M4' springRetryVersion = '1.3.3' - springVersion = '6.0.0-SNAPSHOT' + springVersion = '6.0.0-M5' } dependencies { diff --git a/spring-pulsar-sample-apps/build.gradle b/spring-pulsar-sample-apps/build.gradle index 2e0af1ed..52e04e4b 100644 --- a/spring-pulsar-sample-apps/build.gradle +++ b/spring-pulsar-sample-apps/build.gradle @@ -1,6 +1,6 @@ plugins { id 'org.springframework.pulsar.spring-module' - id 'org.springframework.boot' version '3.0.0-SNAPSHOT' + id 'org.springframework.boot' version '3.0.0-M4' } description = 'Spring Pulsar Sample Applications' diff --git a/spring-pulsar-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-pulsar-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..dc6964b1 --- /dev/null +++ b/spring-pulsar-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.springframework.pulsar.autoconfigure.PulsarAutoConfiguration diff --git a/spring-pulsar-spring-boot-autoconfigure/src/test/java/org/springframework/pulsar/autoconfigure/SpringPulsarBootAppSanityTests.java b/spring-pulsar-spring-boot-autoconfigure/src/test/java/org/springframework/pulsar/autoconfigure/SpringPulsarBootAppSanityTests.java new file mode 100644 index 00000000..891d220d --- /dev/null +++ b/spring-pulsar-spring-boot-autoconfigure/src/test/java/org/springframework/pulsar/autoconfigure/SpringPulsarBootAppSanityTests.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.pulsar.autoconfigure; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; + +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringBootConfiguration; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.pulsar.autoconfigure.SpringPulsarBootAppSanityTests.SpringPulsarBootTestApp; +import org.springframework.pulsar.core.PulsarTemplate; + +/** + * Sanity tests to ensure that {@code Spring Pulsar} can be auto-configured into a Spring + * Boot application. + * + * @author Chris Bono + */ +@SpringBootTest(classes = SpringPulsarBootTestApp.class) +public class SpringPulsarBootAppSanityTests extends AbstractContainerBaseTests { + + @Test + void appStartsWithAutoConfiguredSpringPulsarComponents( + @Autowired ObjectProvider> pulsarTemplate) { + assertThat(pulsarTemplate.getIfAvailable()).isNotNull(); + } + + @SpringBootConfiguration + @EnableAutoConfiguration + static class SpringPulsarBootTestApp { + + } + +} diff --git a/spring-pulsar/src/main/java/org/springframework/pulsar/listener/DefaultPulsarMessageListenerContainer.java b/spring-pulsar/src/main/java/org/springframework/pulsar/listener/DefaultPulsarMessageListenerContainer.java index 0177db1d..87590c15 100644 --- a/spring-pulsar/src/main/java/org/springframework/pulsar/listener/DefaultPulsarMessageListenerContainer.java +++ b/spring-pulsar/src/main/java/org/springframework/pulsar/listener/DefaultPulsarMessageListenerContainer.java @@ -24,8 +24,8 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; @@ -61,10 +61,11 @@ import org.springframework.util.StringUtils; * @param message type. * @author Soby Chacko * @author Alexander Preuß + * @author Chris Bono */ public class DefaultPulsarMessageListenerContainer extends AbstractPulsarMessageListenerContainer { - private volatile CompletableFuture listenerConsumerFuture; + private volatile Future listenerConsumerFuture; private volatile Listener listenerConsumer; @@ -97,7 +98,7 @@ public class DefaultPulsarMessageListenerContainer extends AbstractPulsarMess this.listenerConsumer = new Listener(messageListener); setRunning(true); this.startLatch = new CountDownLatch(1); - this.listenerConsumerFuture = consumerExecutor.submitCompletable(this.listenerConsumer); + this.listenerConsumerFuture = consumerExecutor.submit(this.listenerConsumer); try { if (!this.startLatch.await(containerProperties.getConsumerStartTimeout().toMillis(),