From 80f8c9c82c36c73f1528e65f1c5b14f0cb68999b Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Tue, 13 Sep 2022 10:29:32 -0400 Subject: [PATCH] GH-1473: Remove Unnecessary Deprecated Interfaces See https://github.com/spring-projects/spring-amqp/issues/1473 See https://github.com/spring-projects/spring-amqp/issues/1480 Migration interfaces to assist moving to `CompletableFuture` have been removed from 2.4.x due to Boot auto configuration issues. Therefore, these interfaces never existed in a released version of 2.4.x. --- .../amqp/core/AsyncAmqpTemplate2.java | 32 --------- .../producer/RabbitStreamOperations2.java | 34 ---------- .../producer/RabbitStreamTemplate2.java | 38 ----------- .../amqp/rabbit/AsyncRabbitTemplate2.java | 65 ------------------- .../rabbit/connection/CorrelationData.java | 11 ---- src/reference/asciidoc/amqp.adoc | 2 +- src/reference/asciidoc/appendix.adoc | 5 -- src/reference/asciidoc/stream.adoc | 10 +-- src/reference/asciidoc/whats-new.adoc | 5 +- 9 files changed, 8 insertions(+), 194 deletions(-) delete mode 100644 spring-amqp/src/main/java/org/springframework/amqp/core/AsyncAmqpTemplate2.java delete mode 100644 spring-rabbit-stream/src/main/java/org/springframework/rabbit/stream/producer/RabbitStreamOperations2.java delete mode 100644 spring-rabbit-stream/src/main/java/org/springframework/rabbit/stream/producer/RabbitStreamTemplate2.java delete mode 100644 spring-rabbit/src/main/java/org/springframework/amqp/rabbit/AsyncRabbitTemplate2.java diff --git a/spring-amqp/src/main/java/org/springframework/amqp/core/AsyncAmqpTemplate2.java b/spring-amqp/src/main/java/org/springframework/amqp/core/AsyncAmqpTemplate2.java deleted file mode 100644 index cf835e7884..0000000000 --- a/spring-amqp/src/main/java/org/springframework/amqp/core/AsyncAmqpTemplate2.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.amqp.core; - -import java.util.concurrent.CompletableFuture; - -/** - * This interface was added in 2.4.7 to aid migration from methods returning - * {@code ListenableFuture}s to {@link CompletableFuture}s. - * - * @author Gary Russell - * @since 2.4.7 - * @deprecated in favor of {@link AsyncAmqpTemplate}. - */ -@Deprecated -public interface AsyncAmqpTemplate2 extends AsyncAmqpTemplate { - -} diff --git a/spring-rabbit-stream/src/main/java/org/springframework/rabbit/stream/producer/RabbitStreamOperations2.java b/spring-rabbit-stream/src/main/java/org/springframework/rabbit/stream/producer/RabbitStreamOperations2.java deleted file mode 100644 index e1e9323748..0000000000 --- a/spring-rabbit-stream/src/main/java/org/springframework/rabbit/stream/producer/RabbitStreamOperations2.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.rabbit.stream.producer; - -import java.util.concurrent.CompletableFuture; - -/** - * Provides methods for sending messages using a RabbitMQ Stream producer, - * returning {@link CompletableFuture}. - * This interface was added in 2.4.7 to aid migration from methods returning - * {@code ListenableFuture}s to {@link CompletableFuture}s. - * - * @author Gary Russell - * @since 2.4.7 - * @deprecated in favor of {@link RabbitStreamOperations}. - */ -@Deprecated -public interface RabbitStreamOperations2 extends RabbitStreamOperations { - -} diff --git a/spring-rabbit-stream/src/main/java/org/springframework/rabbit/stream/producer/RabbitStreamTemplate2.java b/spring-rabbit-stream/src/main/java/org/springframework/rabbit/stream/producer/RabbitStreamTemplate2.java deleted file mode 100644 index 664515f404..0000000000 --- a/spring-rabbit-stream/src/main/java/org/springframework/rabbit/stream/producer/RabbitStreamTemplate2.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.rabbit.stream.producer; - -import java.util.concurrent.CompletableFuture; - -import com.rabbitmq.stream.Environment; - -/** - * This interface was added in 2.4.7 to aid migration from methods returning - * {@code ListenableFuture}s to {@link CompletableFuture}s. - * - * @author Gary Russell - * @since 2.8 - * @deprecated in favor of {@link RabbitStreamTemplate}. - */ -@Deprecated -public class RabbitStreamTemplate2 extends RabbitStreamTemplate implements RabbitStreamOperations2 { - - public RabbitStreamTemplate2(Environment environment, String streamName) { - super(environment, streamName); - } - -} diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/AsyncRabbitTemplate2.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/AsyncRabbitTemplate2.java deleted file mode 100644 index 0bc828ec60..0000000000 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/AsyncRabbitTemplate2.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.amqp.rabbit; - -import java.util.concurrent.CompletableFuture; - -import org.springframework.amqp.core.AsyncAmqpTemplate2; -import org.springframework.amqp.rabbit.connection.ConnectionFactory; -import org.springframework.amqp.rabbit.core.RabbitTemplate; -import org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer; - -/** - * This class was added in 2.4.7 to aid migration from methods returning - * {@code ListenableFuture}s to {@link CompletableFuture}s. - * - * @author Gary Russell - * @since 2.4.7 - * @deprecated in favor of {@link AsyncRabbitTemplate}. - * - */ -@Deprecated -public class AsyncRabbitTemplate2 extends AsyncRabbitTemplate implements AsyncAmqpTemplate2 { - - public AsyncRabbitTemplate2(ConnectionFactory connectionFactory, String exchange, String routingKey, - String replyQueue, String replyAddress) { - super(connectionFactory, exchange, routingKey, replyQueue, replyAddress); - } - - public AsyncRabbitTemplate2(ConnectionFactory connectionFactory, String exchange, String routingKey, - String replyQueue) { - super(connectionFactory, exchange, routingKey, replyQueue); - } - - public AsyncRabbitTemplate2(ConnectionFactory connectionFactory, String exchange, String routingKey) { - super(connectionFactory, exchange, routingKey); - } - - public AsyncRabbitTemplate2(RabbitTemplate template, AbstractMessageListenerContainer container, - String replyAddress) { - super(template, container, replyAddress); - } - - public AsyncRabbitTemplate2(RabbitTemplate template, AbstractMessageListenerContainer container) { - super(template, container); - } - - public AsyncRabbitTemplate2(RabbitTemplate template) { - super(template); - } - -} diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CorrelationData.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CorrelationData.java index b6909d5180..9967ffa1f1 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CorrelationData.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CorrelationData.java @@ -94,17 +94,6 @@ public CompletableFuture getFuture() { return this.future; } - /** - * Return a future to check the success/failure of the publish operation. - * @return the future. - * @since 2.4.7 - * @deprecated as of 3.0, in favor of {@link #getFuture()}. - */ - @Deprecated - public CompletableFuture getCompletableFuture() { - return this.future; - } - /** * Get the returned message and metadata, if any. Guaranteed to be populated before * the future is set. diff --git a/src/reference/asciidoc/amqp.adoc b/src/reference/asciidoc/amqp.adoc index dc011b1666..e62ec7a034 100644 --- a/src/reference/asciidoc/amqp.adoc +++ b/src/reference/asciidoc/amqp.adoc @@ -4677,7 +4677,7 @@ Version 2.0 introduced variants of these methods (`convertSendAndReceiveAsType`) You must configure the underlying `RabbitTemplate` with a `SmartMessageConverter`. See <> for more information. -The `AsyncRabbitTemplate2` (added to assist with migration to this release) is now deprecated in favor of `AsyncRabbitTemplate` which now returns `CompletableFuture` s instead of `ListenableFuture` s. +IMPORTANT: Starting with version 3.0, the `AsyncRabbitTemplate` methods now return `CompletableFuture` s instead of `ListenableFuture` s. [[remoting]] ===== Spring Remoting with AMQP diff --git a/src/reference/asciidoc/appendix.adoc b/src/reference/asciidoc/appendix.adoc index a48fb8d433..b78fc1da3e 100644 --- a/src/reference/asciidoc/appendix.adoc +++ b/src/reference/asciidoc/appendix.adoc @@ -34,11 +34,6 @@ Support remoting using Spring Framework’s RMI support is deprecated and will b The `Jackson2JsonMessageConverter` can now determine the charset from the `contentEncoding` header. See <> for more information. -==== AsyncRabbitTemplate - -The `AsyncRabbitTemplate` is deprecated in favor of `AsyncRabbitTemplate2` which returns `CompletableFuture` s instead of `ListenableFuture` s. -See <> for more information. - ==== Message Converter Changes The `Jackson2JsonMessageConverter` can now determine the charset from the `contentEncoding` header. diff --git a/src/reference/asciidoc/stream.adoc b/src/reference/asciidoc/stream.adoc index 776eb5f3a7..8de6ca0596 100644 --- a/src/reference/asciidoc/stream.adoc +++ b/src/reference/asciidoc/stream.adoc @@ -16,13 +16,13 @@ The `RabbitStreamTemplate` provides a subset of the `RabbitTemplate` (AMQP) func ---- public interface RabbitStreamOperations extends AutoCloseable { - ListenableFuture send(Message message); + ConvertableFuture send(Message message); - ListenableFuture convertAndSend(Object message); + ConvertableFuture convertAndSend(Object message); - ListenableFuture convertAndSend(Object message, @Nullable MessagePostProcessor mpp); + ConvertableFuture convertAndSend(Object message, @Nullable MessagePostProcessor mpp); - ListenableFuture send(com.rabbitmq.stream.Message message); + ConvertableFuture send(com.rabbitmq.stream.Message message); MessageBuilder messageBuilder(); @@ -67,7 +67,7 @@ The `ProducerCustomizer` provides a mechanism to customize the producer before i Refer to the https://rabbitmq.github.io/rabbitmq-stream-java-client/stable/htmlsingle/[Java Client Documentation] about customizing the `Environment` and `Producer`. -IMPORTANT: In version 2.4.7 `RabbitStreamOperations2` and `RabbitStreamTemplate2` were added to assist migration to this version; `RabbitStreamOperations2` and `RabbitStreamTemplate2` are now deprecated in favor of `RabbitStreamOperations` and `RabbitStreamTemplate` respectively. +IMPORTANT: Starting with version 3.0, the method return types are `CompletableFuture` instead of `ListenableFuture`. ==== Receiving Messages diff --git a/src/reference/asciidoc/whats-new.adoc b/src/reference/asciidoc/whats-new.adoc index 2b43baca63..995271622b 100644 --- a/src/reference/asciidoc/whats-new.adoc +++ b/src/reference/asciidoc/whats-new.adoc @@ -13,13 +13,12 @@ The remoting feature (using RMI) is no longer supported. ==== AsyncRabbitTemplate -The `AsyncRabbitTemplate2`, which was added in 2.4.7 to aid migration to this release, is deprecated in favor of `AsyncRabbitTemplate`. -The `AsyncRabbitTemplate` now returns `CompletableFuture` s instead of `ListenableFuture` s. +IMPORTANT: The `AsyncRabbitTemplate` now returns `CompletableFuture` s instead of `ListenableFuture` s. See <> for more information. ==== Stream Support Changes -`RabbitStreamOperations2` and `RabbitStreamTemplate2` have been deprecated in favor of `RabbitStreamOperations` and `RabbitStreamTemplate` respectively. +IMPORTANT: `RabbitStreamOperations` and `RabbitStreamTemplate` methods now return `CompletableFuture` instead of `ListenableFuture`. Super streams and single active consumers thereon are now supported.