diff --git a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/ConsumerStopAction.java b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/ConsumerStopAction.java deleted file mode 100644 index 1bffae3f94..0000000000 --- a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/ConsumerStopAction.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2015-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. - * 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.integration.mqtt.core; - -/** - * Action to take regarding subscriptions when consumer stops. - * - * @author Gary Russell - * - * @since 4.2.3 - * - * @deprecated since 5.5.17 - * in favor of standard {@link org.eclipse.paho.client.mqttv3.MqttConnectOptions#setCleanSession(boolean)}. - * Will be removed in 6.1.0. - */ -@Deprecated -public enum ConsumerStopAction { - - /** - * Never unsubscribe. - */ - UNSUBSCRIBE_NEVER, - - /** - * Always unsubscribe. - */ - UNSUBSCRIBE_ALWAYS, - - /** - * Unsubscribe if clean session is true. - */ - UNSUBSCRIBE_CLEAN - -} diff --git a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java index 6472173c29..874288c198 100644 --- a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java +++ b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/DefaultMqttPahoClientFactory.java @@ -41,9 +41,6 @@ public class DefaultMqttPahoClientFactory implements MqttPahoClientFactory { private MqttClientPersistence persistence; - @SuppressWarnings("deprecation") - private ConsumerStopAction consumerStopAction = ConsumerStopAction.UNSUBSCRIBE_CLEAN; - /** * Set the persistence to pass into the client constructor. * @param persistence the persistence to set. @@ -52,32 +49,6 @@ public class DefaultMqttPahoClientFactory implements MqttPahoClientFactory { this.persistence = persistence; } - /** - * Get the consumer stop action. - * @return the consumer stop action. - * @since 4.2.3 - * @deprecated since 5.5.17 in favor of standard {@link MqttConnectOptions#setCleanSession(boolean)}. - * Will be removed in 6.1.0. - */ - @Deprecated - @Override - public ConsumerStopAction getConsumerStopAction() { - return this.consumerStopAction; - } - - /** - * Set the consumer stop action. Determines whether we unsubscribe when the consumer stops. - * Default: {@link ConsumerStopAction#UNSUBSCRIBE_CLEAN}. - * @param consumerStopAction the consumer stop action. - * @since 4.2.3. - * @deprecated since 5.5.17 in favor of standard {@link MqttConnectOptions#setCleanSession(boolean)}. - * Will be removed in 6.1.0. - */ - @Deprecated - public void setConsumerStopAction(ConsumerStopAction consumerStopAction) { - this.consumerStopAction = consumerStopAction; - } - @Override public IMqttClient getClientInstance(String uri, String clientId) throws MqttException { // Client validates URI even if overridden by options diff --git a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/MqttPahoClientFactory.java b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/MqttPahoClientFactory.java index f15e0208ec..5a6d37d6b9 100644 --- a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/MqttPahoClientFactory.java +++ b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/core/MqttPahoClientFactory.java @@ -56,14 +56,4 @@ public interface MqttPahoClientFactory { */ MqttConnectOptions getConnectionOptions(); - /** - * Get the consumer stop action. - * @return the consumer stop action. - * @since 4.3 - * @deprecated since 5.5.17 in favor of standard {@link MqttConnectOptions#setCleanSession(boolean)}. - * Will be removed in 6.1.0. - */ - @Deprecated - ConsumerStopAction getConsumerStopAction(); - } diff --git a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/MqttPahoMessageDrivenChannelAdapter.java b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/MqttPahoMessageDrivenChannelAdapter.java index 7758ae94bc..26a8f29c89 100644 --- a/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/MqttPahoMessageDrivenChannelAdapter.java +++ b/spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/inbound/MqttPahoMessageDrivenChannelAdapter.java @@ -68,9 +68,6 @@ public class MqttPahoMessageDrivenChannelAdapter private volatile IMqttAsyncClient client; - @SuppressWarnings("deprecation") - private volatile org.springframework.integration.mqtt.core.ConsumerStopAction consumerStopAction; - private volatile boolean readyToSubscribeOnStart; /** @@ -184,11 +181,6 @@ public class MqttPahoMessageDrivenChannelAdapter @SuppressWarnings("deprecation") private synchronized void connect() throws MqttException { MqttConnectOptions connectionOptions = this.clientFactory.getConnectionOptions(); - this.consumerStopAction = this.clientFactory.getConsumerStopAction(); - if (this.consumerStopAction == null) { - this.consumerStopAction = org.springframework.integration.mqtt.core.ConsumerStopAction.UNSUBSCRIBE_CLEAN; - } - var clientManager = getClientManager(); if (clientManager == null) { Assert.state(getUrl() != null || connectionOptions.getServerURIs() != null, @@ -203,17 +195,11 @@ public class MqttPahoMessageDrivenChannelAdapter } } - @SuppressWarnings("deprecation") @Override protected synchronized void doStop() { this.readyToSubscribeOnStart = false; try { - if (this.consumerStopAction - .equals(org.springframework.integration.mqtt.core.ConsumerStopAction.UNSUBSCRIBE_ALWAYS) - || (this.consumerStopAction - .equals(org.springframework.integration.mqtt.core.ConsumerStopAction.UNSUBSCRIBE_CLEAN) - && this.clientFactory.getConnectionOptions().isCleanSession())) { - + if (this.clientFactory.getConnectionOptions().isCleanSession()) { this.client.unsubscribe(getTopic()); // Have to re-subscribe on next start if connection is not lost. this.readyToSubscribeOnStart = true;