GH-2522: Upgrade to Rabbit Streams 0.14.0

Fixes https://github.com/spring-projects/spring-amqp/issues/2522

The latest `com.rabbitmq:stream-client` has some convenient fixes for
local environment development (including Docker image).

Therefore, fix all the Streams test to use just `.port(streamPort())` option
for the `Environment` instead of custom `addressResolver`
This commit is contained in:
Gary Russell
2023-10-02 12:18:12 -04:00
committed by Artem Bilan
parent 613c2895ab
commit 761be85a68
5 changed files with 12 additions and 12 deletions

View File

@@ -63,7 +63,7 @@ ext {
micrometerVersion = '1.12.0-RC1'
micrometerTracingVersion = '1.2.0-RC1'
mockitoVersion = '5.5.0'
rabbitmqStreamVersion = '0.12.0'
rabbitmqStreamVersion = '0.14.0'
rabbitmqVersion = project.hasProperty('rabbitmqVersion') ? project.rabbitmqVersion : '5.18.0'
reactorVersion = '2023.0.0-RC1'
snappyVersion = '1.1.8.4'

View File

@@ -61,7 +61,6 @@ import org.springframework.web.reactive.function.client.ExchangeFilterFunctions;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.util.UriUtils;
import com.rabbitmq.stream.Address;
import com.rabbitmq.stream.Environment;
import com.rabbitmq.stream.Message;
import com.rabbitmq.stream.MessageHandler.Context;
@@ -75,6 +74,7 @@ import io.micrometer.observation.ObservationRegistry;
/**
* @author Gary Russell
* @author Artem Bilan
* @since 2.4
*
*/
@@ -203,7 +203,7 @@ public class RabbitListenerTests extends AbstractTestContainerTests {
@Bean
static Environment environment() {
return Environment.builder()
.addressResolver(add -> new Address("localhost", streamPort()))
.port(streamPort())
.build();
}
@@ -395,6 +395,6 @@ public class RabbitListenerTests extends AbstractTestContainerTests {
.build();
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022 the original author or authors.
* Copyright 2022-2023 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.
@@ -39,12 +39,12 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.rabbit.stream.config.SuperStream;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.rabbitmq.stream.Address;
import com.rabbitmq.stream.Environment;
import com.rabbitmq.stream.OffsetSpecification;
/**
* @author Gary Russell
* @author Artem Bilan
* @since 3.0
*
*/
@@ -105,7 +105,7 @@ public class SuperStreamConcurrentSACTests extends AbstractTestContainerTests {
@Bean
static Environment environment() {
return Environment.builder()
.addressResolver(add -> new Address("localhost", streamPort()))
.port(streamPort())
.maxConsumersByConnection(1)
.build();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022 the original author or authors.
* Copyright 2022-2023 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.
@@ -47,12 +47,12 @@ import org.springframework.context.annotation.Scope;
import org.springframework.rabbit.stream.config.SuperStream;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.rabbitmq.stream.Address;
import com.rabbitmq.stream.Environment;
import com.rabbitmq.stream.OffsetSpecification;
/**
* @author Gary Russell
* @author Artem Bilan
* @since 3.0
*
*/
@@ -122,7 +122,7 @@ public class SuperStreamSACTests extends AbstractTestContainerTests {
@Bean
static Environment environment() {
return Environment.builder()
.addressResolver(add -> new Address("localhost", streamPort()))
.port(streamPort())
.build();
}

View File

@@ -38,7 +38,6 @@ import org.springframework.rabbit.stream.listener.StreamListenerContainer;
import org.springframework.rabbit.stream.producer.RabbitStreamTemplate;
import org.springframework.rabbit.stream.support.StreamAdmin;
import com.rabbitmq.stream.Address;
import com.rabbitmq.stream.Environment;
import com.rabbitmq.stream.Message;
import com.rabbitmq.stream.OffsetSpecification;
@@ -51,6 +50,7 @@ import io.micrometer.tracing.test.simple.SpansAssert;
/**
* @author Gary Russell
* @author Artem Bilan
* @since 3.0.5
*
*/
@@ -106,7 +106,7 @@ public class TracingTests extends SampleTestRunner {
@Bean
static Environment environment() {
return Environment.builder()
.addressResolver(add -> new Address("localhost", AbstractTestContainerTests.streamPort()))
.port(AbstractTestContainerTests.streamPort())
.build();
}