Skip to content

Commit

Permalink
Use SB/SF milestone libs for M1 release
Browse files Browse the repository at this point in the history
- Made the following TEMPORARY changes to appease downgrading to SB/SF milestones:
  - Removed `AsynTaskExecutor.submitCompletable` (only in SF snaphot)
  - Revert b188436 (auto-generated auto-config imports file only in SB snapshot)
- Added SpringBootTest sanity test to catch when auto-config is not in place.
  • Loading branch information
onobc committed Sep 13, 2022
1 parent 4fd61b9 commit e14dbb7
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 7 deletions.
6 changes: 3 additions & 3 deletions spring-pulsar-dependencies/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion spring-pulsar-sample-apps/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.springframework.pulsar.autoconfigure.PulsarAutoConfiguration
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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 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;

import static org.assertj.core.api.Assertions.assertThat;

/**
* 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<String>> pulsarTemplate) {
assertThat(pulsarTemplate.getIfAvailable()).isNotNull();
}

@SpringBootConfiguration
@EnableAutoConfiguration
static class SpringPulsarBootTestApp {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
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;
Expand Down Expand Up @@ -61,10 +61,11 @@
* @param <T> message type.
* @author Soby Chacko
* @author Alexander Preuß
* @author Chris Bono
*/
public class DefaultPulsarMessageListenerContainer<T> extends AbstractPulsarMessageListenerContainer<T> {

private volatile CompletableFuture<?> listenerConsumerFuture;
private volatile Future<?> listenerConsumerFuture;

private volatile Listener listenerConsumer;

Expand Down Expand Up @@ -97,7 +98,7 @@ protected void doStart() {
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(),
Expand Down

0 comments on commit e14dbb7

Please sign in to comment.