Clean up some JavaDocs; remove deprecated API
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2021 the original author or authors.
|
||||
* Copyright 2016-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.
|
||||
@@ -618,25 +618,6 @@ public abstract class AbstractAmqpOutboundEndpoint extends AbstractReplyProducin
|
||||
: getMessageBuilderFactory().withPayload(replyObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build Spring message object based on the provided returned AMQP message info.
|
||||
* @param message the returned AMQP message
|
||||
* @param replyCode the returned message reason code
|
||||
* @param replyText the returned message reason text
|
||||
* @param exchange the exchange the message returned from
|
||||
* @param returnedRoutingKey the routing key for returned message
|
||||
* @param converter the converter to deserialize body of the returned AMQP message
|
||||
* @return the Spring message which represents a returned AMQP message
|
||||
* @deprecated since 5.4 in favor of {@link #buildReturnedMessage(ReturnedMessage, MessageConverter)}
|
||||
*/
|
||||
@Deprecated
|
||||
protected Message<?> buildReturnedMessage(org.springframework.amqp.core.Message message,
|
||||
int replyCode, String replyText, String exchange, String returnedRoutingKey, MessageConverter converter) {
|
||||
|
||||
return buildReturnedMessage(new ReturnedMessage(message, replyCode, replyText, exchange, returnedRoutingKey),
|
||||
converter);
|
||||
}
|
||||
|
||||
protected Message<?> buildReturnedMessage(ReturnedMessage returnedMessage, MessageConverter converter) {
|
||||
org.springframework.amqp.core.Message amqpMessage = returnedMessage.getMessage();
|
||||
Object returnedObject = converter.fromMessage(amqpMessage);
|
||||
@@ -731,15 +712,6 @@ public abstract class AbstractAmqpOutboundEndpoint extends AbstractReplyProducin
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setReturnedMessage(org.springframework.amqp.core.Message returnedMessage) {
|
||||
if (this.userData instanceof CorrelationData) {
|
||||
((CorrelationData) this.userData).setReturnedMessage(returnedMessage);
|
||||
}
|
||||
super.setReturnedMessage(returnedMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReturned(ReturnedMessage returned) {
|
||||
if (this.userData instanceof CorrelationData) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2020 the original author or authors.
|
||||
* Copyright 2019-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.
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.integration.amqp.support;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.support.ListenerExecutionFailedException;
|
||||
|
||||
@@ -26,37 +28,20 @@ import com.rabbitmq.client.Channel;
|
||||
* Used for conversion errors when using manual acks.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 5.1.3
|
||||
*
|
||||
*/
|
||||
public class ManualAckListenerExecutionFailedException extends ListenerExecutionFailedException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Channel channel;
|
||||
|
||||
private final long deliveryTag;
|
||||
|
||||
/**
|
||||
* Construct an instance with the provided properties.
|
||||
* @param msg the exception message.
|
||||
* @param cause the cause.
|
||||
* @param failedMessage the failed message.
|
||||
* @param channel the channel.
|
||||
* @param deliveryTag the delivery tag for the message.
|
||||
* @deprecated in favor of
|
||||
* {@link #ManualAckListenerExecutionFailedException(String, Throwable, Channel, long, Message...)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public ManualAckListenerExecutionFailedException(String msg, Throwable cause, Message failedMessage,
|
||||
Channel channel, long deliveryTag) {
|
||||
|
||||
super(msg, cause, failedMessage);
|
||||
this.channel = channel;
|
||||
this.deliveryTag = deliveryTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance with the provided properties.
|
||||
* @param msg the exception message.
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015-2020 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.aop;
|
||||
|
||||
/**
|
||||
* Advice for a {@link org.springframework.integration.core.MessageSource#receive()} method to decide whether a poll
|
||||
* should be ignored and/or take action after the receive.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 4.2
|
||||
*
|
||||
* @deprecated since 5.3 in favor of {@link MessageSourceMutator}.
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class AbstractMessageSourceAdvice implements MessageSourceMutator {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2020 the original author or authors.
|
||||
* Copyright 2015-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.
|
||||
@@ -18,7 +18,6 @@ package org.springframework.integration.aop;
|
||||
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.util.CompoundTrigger;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.scheduling.Trigger;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -55,17 +54,9 @@ public class CompoundTriggerAdvice
|
||||
* @param result the received message.
|
||||
* @param source the message source.
|
||||
* @return the message or null
|
||||
* @deprecated since 5.3 in favor of {@link #afterReceive(Message, Object)}
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public Message<?> afterReceive(Message<?> result, MessageSource<?> source) {
|
||||
return afterReceive(result, (Object) source);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message<?> afterReceive(@Nullable Message<?> result, Object source) {
|
||||
if (result == null) {
|
||||
this.compoundTrigger.setOverride(this.override);
|
||||
}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015-2020 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.aop;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.util.DynamicPeriodicTrigger;
|
||||
import org.springframework.messaging.Message;
|
||||
|
||||
/**
|
||||
* A simple advice that polls at one rate when messages exist and another when
|
||||
* there are no messages.
|
||||
*
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @since 4.2
|
||||
*
|
||||
* @see DynamicPeriodicTrigger
|
||||
*
|
||||
* @deprecated since 5.3 in favor of {@link SimpleActiveIdleReceiveMessageAdvice} with the same
|
||||
* (but more common) functionality.
|
||||
*/
|
||||
@Deprecated
|
||||
public class SimpleActiveIdleMessageSourceAdvice extends AbstractMessageSourceAdvice {
|
||||
|
||||
private final DynamicPeriodicTrigger trigger;
|
||||
|
||||
private volatile Duration idlePollPeriod;
|
||||
|
||||
private volatile Duration activePollPeriod;
|
||||
|
||||
|
||||
public SimpleActiveIdleMessageSourceAdvice(DynamicPeriodicTrigger trigger) {
|
||||
this.trigger = trigger;
|
||||
this.idlePollPeriod = trigger.getDuration();
|
||||
this.activePollPeriod = trigger.getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the poll period when messages are not returned. Defaults to the
|
||||
* trigger's period.
|
||||
* @param idlePollPeriod the period in milliseconds.
|
||||
*/
|
||||
public void setIdlePollPeriod(long idlePollPeriod) {
|
||||
this.idlePollPeriod = Duration.ofMillis(idlePollPeriod);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the poll period when messages are returned. Defaults to the
|
||||
* trigger's period.
|
||||
* @param activePollPeriod the period in milliseconds.
|
||||
*/
|
||||
public void setActivePollPeriod(long activePollPeriod) {
|
||||
this.activePollPeriod = Duration.ofMillis(activePollPeriod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message<?> afterReceive(Message<?> result, MessageSource<?> source) {
|
||||
if (result == null) {
|
||||
this.trigger.setDuration(this.idlePollPeriod);
|
||||
}
|
||||
else {
|
||||
this.trigger.setDuration(this.activePollPeriod);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017-2020 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.channel;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
import org.springframework.integration.util.IntegrationReactiveUtils;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
|
||||
/**
|
||||
* Utilities for adaptation {@link MessageChannel}s to the {@link Publisher}s.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 5.0
|
||||
*
|
||||
* @deprecated since 5.3 in favor of {@link IntegrationReactiveUtils}.
|
||||
*/
|
||||
@Deprecated
|
||||
public final class MessageChannelReactiveUtils {
|
||||
|
||||
private MessageChannelReactiveUtils() {
|
||||
}
|
||||
|
||||
public static <T> Publisher<Message<T>> toPublisher(MessageChannel messageChannel) {
|
||||
return IntegrationReactiveUtils.messageChannelToFlux(messageChannel);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-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.
|
||||
@@ -42,33 +42,19 @@ import org.springframework.integration.support.management.micrometer.MicrometerM
|
||||
@Import({ MicrometerMetricsCaptorImportSelector.class, IntegrationManagementConfiguration.class })
|
||||
public @interface EnableIntegrationManagement {
|
||||
|
||||
/**
|
||||
* @deprecated this property is no longer used.
|
||||
* @return the patterns.
|
||||
*/
|
||||
@Deprecated
|
||||
String[] metersEnabled() default "*";
|
||||
|
||||
/**
|
||||
* @deprecated this property is no longer used.
|
||||
* @return the value; false by default, or true when JMX is enabled.
|
||||
*/
|
||||
@Deprecated
|
||||
String defaultCountsEnabled() default "false";
|
||||
|
||||
/**
|
||||
* Use to disable all logging in the main message flow in framework components. When 'false', such logging will be
|
||||
* skipped, regardless of logging level. When 'true', the logging is controlled as normal by the logging
|
||||
* subsystem log level configuration.
|
||||
* Use for disabling all logging in the main message flow in framework components. When 'false',
|
||||
* such logging will be skipped, regardless of logging level. When 'true',
|
||||
* the logging is controlled as normal by the logging subsystem log level configuration.
|
||||
* <p>
|
||||
* It has been found that in high-volume messaging environments, calls to methods such as
|
||||
* {@code logger.isDebuggingEnabled()} can be quite expensive and account for an inordinate amount of CPU
|
||||
* time.
|
||||
* <p>
|
||||
* Set this to false to disable logging by default in all framework components that implement
|
||||
* Set this to false for disabling logging by default in all framework components that implement
|
||||
* {@link org.springframework.integration.support.management.IntegrationManagement}
|
||||
* (channels, message handlers etc). This turns off logging such as
|
||||
* "PreSend on channel", "Received message" etc.
|
||||
* (channels, message handlers etc). It turns off logging such as "PreSend on channel", "Received message" etc.
|
||||
* <p>
|
||||
* After the context is initialized, individual components can have their setting changed by invoking
|
||||
* {@link org.springframework.integration.support.management.IntegrationManagement#setLoggingEnabled(boolean)}.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-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.
|
||||
@@ -20,7 +20,6 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.context.IntegrationContextUtils;
|
||||
|
||||
/**
|
||||
* Shared utility methods for Integration configuration.
|
||||
@@ -31,12 +30,6 @@ import org.springframework.integration.context.IntegrationContextUtils;
|
||||
*/
|
||||
public final class IntegrationConfigUtils {
|
||||
|
||||
/**
|
||||
* @deprecated in favor of {@link IntegrationContextUtils#BASE_PACKAGE}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String BASE_PACKAGE = IntegrationContextUtils.BASE_PACKAGE;
|
||||
|
||||
public static final String HANDLER_ALIAS_SUFFIX = ".handler";
|
||||
|
||||
public static void registerSpelFunctionBean(BeanDefinitionRegistry registry, String functionId, String className,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -110,12 +110,6 @@ public abstract class IntegrationContextUtils {
|
||||
public static final String ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME =
|
||||
"integrationArgumentResolverMessageConverter";
|
||||
|
||||
/**
|
||||
* @deprecated since 5.5.7 - out of use.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String DISPOSABLES_BEAN_NAME = "integrationDisposableAutoCreatedBeans";
|
||||
|
||||
public static final String MESSAGE_HANDLER_FACTORY_BEAN_NAME = "integrationMessageHandlerMethodFactory";
|
||||
|
||||
public static final String LIST_MESSAGE_HANDLER_FACTORY_BEAN_NAME = "integrationListMessageHandlerMethodFactory";
|
||||
@@ -209,8 +203,7 @@ public abstract class IntegrationContextUtils {
|
||||
propertiesToRegister.putAll(userProperties);
|
||||
}
|
||||
|
||||
if (beanFactory instanceof BeanDefinitionRegistry) {
|
||||
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
|
||||
if (beanFactory instanceof BeanDefinitionRegistry registry) {
|
||||
RootBeanDefinition beanDefinition = new RootBeanDefinition(Properties.class);
|
||||
beanDefinition.setInstanceSupplier(() -> propertiesToRegister);
|
||||
|
||||
|
||||
@@ -631,7 +631,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate the {@link MessageTransformingHandler} instance for the
|
||||
* {@link org.springframework.integration.handler.MessageProcessor} from provided {@link MessageProcessorSpec}.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .transform(Scripts.script("classpath:myScript.py").variable("foo", bar()),
|
||||
@@ -708,7 +708,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate the {@link MessageTransformingHandler} instance for the provided {@link GenericTransformer}
|
||||
* for the specific {@code expectedType} to convert at runtime.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* @param expectedType the {@link Class} for expected payload type. It can also be
|
||||
* {@code Message.class} if you wish to access the entire message in the transformer.
|
||||
* Conversion to this type will be attempted, if necessary.
|
||||
@@ -744,7 +744,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
|
||||
/**
|
||||
* Populate a {@link MessageFilter} with {@link MessageSelector} for the provided SpEL expression.
|
||||
* In addition accept options for the integration endpoint using {@link FilterEndpointSpec}:
|
||||
* In addition, accept options for the integration endpoint using {@link FilterEndpointSpec}:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .filter("payload.hot"), e -> e.autoStartup(false))
|
||||
@@ -820,7 +820,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate a {@link MessageFilter} with {@link MethodInvokingSelector}
|
||||
* for the {@link MessageProcessor} from
|
||||
* the provided {@link MessageProcessorSpec}.
|
||||
* In addition accept options for the integration endpoint using {@link FilterEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link FilterEndpointSpec}.
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .filter(Scripts.script(scriptResource).lang("ruby"),
|
||||
@@ -910,7 +910,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate a {@link ServiceActivatingHandler} for the provided
|
||||
* {@link MessageHandler} implementation.
|
||||
* Can be used as Java 8 Lambda expression:
|
||||
* Can be used as Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .handle(m -> logger.info(m.getPayload())
|
||||
@@ -939,7 +939,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate a {@link ServiceActivatingHandler} for the
|
||||
* {@link org.springframework.integration.handler.MethodInvokingMessageProcessor}
|
||||
* to invoke the {@code method} for provided {@code bean} at runtime.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* @param beanName the bean name to use.
|
||||
* @param methodName the method to invoke.
|
||||
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
|
||||
@@ -966,7 +966,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate a {@link ServiceActivatingHandler} for the
|
||||
* {@link org.springframework.integration.handler.MethodInvokingMessageProcessor}
|
||||
* to invoke the {@code method} for provided {@code bean} at runtime.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* @param service the service object to use.
|
||||
* @param methodName the method to invoke.
|
||||
* @return the current {@link BaseIntegrationFlowDefinition}.
|
||||
@@ -979,7 +979,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate a {@link ServiceActivatingHandler} for the
|
||||
* {@link org.springframework.integration.handler.MethodInvokingMessageProcessor}
|
||||
* to invoke the {@code method} for provided {@code bean} at runtime.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* @param service the service object to use.
|
||||
* @param methodName the method to invoke.
|
||||
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
|
||||
@@ -1002,7 +1002,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate a {@link ServiceActivatingHandler} for the
|
||||
* {@link org.springframework.integration.handler.MethodInvokingMessageProcessor}
|
||||
* to invoke the provided {@link GenericHandler} at runtime.
|
||||
* Typically, used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .handle(Integer.class, (p, h) -> p / 2)
|
||||
@@ -1024,8 +1024,8 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate a {@link ServiceActivatingHandler} for the
|
||||
* {@link org.springframework.integration.handler.MethodInvokingMessageProcessor}
|
||||
* to invoke the provided {@link GenericHandler} at runtime.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .handle(Integer.class, (p, h) -> p / 2, e -> e.autoStartup(false))
|
||||
@@ -1076,7 +1076,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate a {@link ServiceActivatingHandler} for the
|
||||
* {@link MessageProcessor} from the provided
|
||||
* {@link MessageProcessorSpec}.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .handle(Scripts.script("classpath:myScript.ruby"), e -> e.autoStartup(false))
|
||||
@@ -1098,8 +1098,8 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate a {@link ServiceActivatingHandler} for the selected protocol specific
|
||||
* {@link MessageHandler} implementation from {@code Namespace Factory}:
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .handle(Amqp.outboundAdapter(this.amqpTemplate).routingKeyExpression("headers.routingKey"),
|
||||
@@ -1125,8 +1125,8 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate a {@link ServiceActivatingHandler} for the provided
|
||||
* {@link MessageHandler} implementation.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* Can be used as Java 8 Lambda expression:
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* Can be used as Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .handle(m -> logger.info(m.getPayload()), e -> e.autoStartup(false))
|
||||
@@ -1153,7 +1153,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
|
||||
/**
|
||||
* Populate a {@link BridgeHandler} to the current integration flow position.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .bridge(s -> s.poller(Pollers.fixedDelay(100))
|
||||
@@ -1196,7 +1196,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate a {@link org.springframework.integration.transformer.ContentEnricher}
|
||||
* to the current integration flow position
|
||||
* with provided options.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .enrich(e -> e.requestChannel("enrichChannel")
|
||||
@@ -1239,7 +1239,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate a {@link MessageTransformingHandler} for
|
||||
* a {@link org.springframework.integration.transformer.HeaderEnricher}
|
||||
* using header values from provided {@link MapBuilder}.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* Can be used together with {@code Namespace Factory}:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
@@ -1297,7 +1297,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate a {@link MessageTransformingHandler} for
|
||||
* a {@link org.springframework.integration.transformer.HeaderEnricher}
|
||||
* as the result of provided {@link Consumer}.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .enrichHeaders(h -> h.header(FileHeaders.FILENAME, "foo.sitest")
|
||||
@@ -1325,7 +1325,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate the {@link DefaultMessageSplitter} with provided options
|
||||
* to the current integration flow position.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .split(s -> s.applySequence(false).delimiters(","))
|
||||
@@ -1341,8 +1341,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the {@link ExpressionEvaluatingSplitter} with provided
|
||||
* SpEL expression.
|
||||
* Populate the {@link ExpressionEvaluatingSplitter} with provided SpEL expression.
|
||||
* @param expression the splitter SpEL expression.
|
||||
* and for {@link ExpressionEvaluatingSplitter}.
|
||||
* @return the current {@link BaseIntegrationFlowDefinition}.
|
||||
@@ -1353,8 +1352,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the {@link ExpressionEvaluatingSplitter} with provided
|
||||
* SpEL expression.
|
||||
* Populate the {@link ExpressionEvaluatingSplitter} with provided SpEL expression.
|
||||
* @param expression the splitter SpEL expression.
|
||||
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options
|
||||
* and for {@link ExpressionEvaluatingSplitter}.
|
||||
@@ -1392,7 +1390,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate the {@link MethodInvokingSplitter} to evaluate the provided
|
||||
* {@code method} of the {@code bean} at runtime.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* @param service the service to use.
|
||||
* @param methodName the method to invoke.
|
||||
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options
|
||||
@@ -1428,7 +1426,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate the {@link MethodInvokingSplitter} to evaluate the provided
|
||||
* {@code method} of the {@code bean} at runtime.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* @param beanName the bean name to use.
|
||||
* @param methodName the method to invoke at runtime.
|
||||
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options
|
||||
@@ -1464,7 +1462,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate the {@link MethodInvokingSplitter} to evaluate the
|
||||
* {@link MessageProcessor} at runtime
|
||||
* from provided {@link MessageProcessorSpec}.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .split(Scripts.script(myScriptResource).lang("groovy").refreshCheckDelay(1000),
|
||||
@@ -1489,7 +1487,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate the {@link MethodInvokingSplitter} to evaluate the provided
|
||||
* {@link Function} at runtime.
|
||||
* Typically, used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .split(String.class, p ->
|
||||
@@ -1516,7 +1514,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate the {@link MethodInvokingSplitter} to evaluate the provided
|
||||
* {@link Function} at runtime.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* Typically, used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .split(String.class, p ->
|
||||
@@ -1627,8 +1625,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the provided {@link MessageTransformingHandler} for the provided
|
||||
* {@link HeaderFilter}.
|
||||
* Populate the provided {@link MessageTransformingHandler} for the provided {@link HeaderFilter}.
|
||||
* @param headerFilter the {@link HeaderFilter} to use.
|
||||
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
|
||||
* @return the current {@link BaseIntegrationFlowDefinition}.
|
||||
@@ -1653,7 +1650,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate the {@link MessageTransformingHandler} for the {@link ClaimCheckInTransformer}
|
||||
* with provided {@link MessageStore}.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* @param messageStore the {@link MessageStore} to use.
|
||||
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
|
||||
* @return the current {@link BaseIntegrationFlowDefinition}.
|
||||
@@ -1691,7 +1688,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate the {@link MessageTransformingHandler} for the {@link ClaimCheckOutTransformer}
|
||||
* with provided {@link MessageStore} and {@code removeMessage} flag.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* @param messageStore the {@link MessageStore} to use.
|
||||
* @param removeMessage the removeMessage boolean flag.
|
||||
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
|
||||
@@ -1722,7 +1719,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* {@link org.springframework.integration.aggregator.ResequencingMessageHandler} with
|
||||
* provided options from {@link ResequencerSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .resequence(r -> r.releasePartialSequences(true)
|
||||
@@ -1761,7 +1758,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate the {@link AggregatingMessageHandler} with provided options from {@link AggregatorSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .aggregate(a -> a.correlationExpression("1")
|
||||
@@ -1875,7 +1872,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate the {@link MethodInvokingRouter} for provided {@link Function}
|
||||
* and payload type with default options.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .route(Integer.class, p -> p % 2 == 0)
|
||||
@@ -1898,7 +1895,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate the {@link MethodInvokingRouter} for provided {@link Function}
|
||||
* and payload type and options from {@link RouterSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* Typically, used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .route(Integer.class, p -> p % 2 == 0,
|
||||
@@ -1992,8 +1989,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
if (!CollectionUtils.isEmpty(componentsToRegister)) {
|
||||
for (Map.Entry<Object, String> entry : componentsToRegister.entrySet()) {
|
||||
Object component = entry.getKey();
|
||||
if (component instanceof BaseIntegrationFlowDefinition) {
|
||||
BaseIntegrationFlowDefinition<?> flowBuilder = (BaseIntegrationFlowDefinition<?>) component;
|
||||
if (component instanceof BaseIntegrationFlowDefinition<?> flowBuilder) {
|
||||
if (flowBuilder.isOutputChannelRequired()) {
|
||||
registerSubflowBridge = true;
|
||||
flowBuilder.channel(new FixedSubscriberChannel(bridgeHandler));
|
||||
@@ -2020,7 +2016,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
|
||||
/**
|
||||
* Populate the {@link RecipientListRouter} with options from the {@link RecipientListRouterSpec}.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .routeToRecipients(r -> r
|
||||
@@ -2040,7 +2036,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
|
||||
/**
|
||||
* Populate the {@link ErrorMessageExceptionTypeRouter} with options from the {@link RouterSpec}.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .routeByException(r -> r
|
||||
@@ -2072,7 +2068,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
/**
|
||||
* Populate the provided {@link AbstractMessageRouter} implementation to the
|
||||
* current integration flow position.
|
||||
* In addition accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* In addition, accept options for the integration endpoint using {@link GenericEndpointSpec}.
|
||||
* @param router the {@link AbstractMessageRouter} to populate.
|
||||
* @param endpointConfigurer the {@link Consumer} to provide integration endpoint options.
|
||||
* @param <R> the {@link AbstractMessageRouter} type.
|
||||
@@ -2144,7 +2140,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate the "artificial"
|
||||
* {@link org.springframework.integration.gateway.GatewayMessageHandler} for the
|
||||
* provided {@code subflow}.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* Typically, used with aLambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .gateway(f -> f.transform("From Gateway SubFlow: "::concat))
|
||||
@@ -2161,7 +2157,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
* Populate the "artificial"
|
||||
* {@link org.springframework.integration.gateway.GatewayMessageHandler} for the
|
||||
* provided {@code subflow} with options from {@link GatewayEndpointSpec}.
|
||||
* Typically used with a Java 8 Lambda expression:
|
||||
* Typically, used with a Lambda expression:
|
||||
* <pre class="code">
|
||||
* {@code
|
||||
* .gateway(f -> f.transform("From Gateway SubFlow: "::concat), e -> e.replyTimeout(100L))
|
||||
@@ -3009,8 +3005,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
channelName = ((MessageChannelReference) outputChannel).getName();
|
||||
}
|
||||
|
||||
if (currComponent instanceof MessageProducer) {
|
||||
MessageProducer messageProducer = (MessageProducer) currComponent;
|
||||
if (currComponent instanceof MessageProducer messageProducer) {
|
||||
checkReuse(messageProducer);
|
||||
if (channelName != null) {
|
||||
messageProducer.setOutputChannelName(channelName);
|
||||
@@ -3108,10 +3103,9 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
|
||||
}
|
||||
|
||||
protected static Object extractProxyTarget(Object target) {
|
||||
if (!(target instanceof Advised)) {
|
||||
if (!(target instanceof Advised advised)) {
|
||||
return target;
|
||||
}
|
||||
Advised advised = (Advised) target;
|
||||
try {
|
||||
return extractProxyTarget(advised.getTargetSource().getTarget());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2021 the original author or authors.
|
||||
* Copyright 2016-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.
|
||||
@@ -181,19 +181,14 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
|
||||
* @see AbstractCorrelatingMessageHandler#setReleaseStrategy(ReleaseStrategy)
|
||||
*/
|
||||
public S processor(Object target) {
|
||||
try {
|
||||
CorrelationStrategyFactoryBean correlationStrategyFactoryBean = new CorrelationStrategyFactoryBean();
|
||||
correlationStrategyFactoryBean.setTarget(target);
|
||||
correlationStrategyFactoryBean.afterPropertiesSet();
|
||||
ReleaseStrategyFactoryBean releaseStrategyFactoryBean = new ReleaseStrategyFactoryBean();
|
||||
releaseStrategyFactoryBean.setTarget(target);
|
||||
releaseStrategyFactoryBean.afterPropertiesSet();
|
||||
return correlationStrategy(correlationStrategyFactoryBean.getObject())
|
||||
.releaseStrategy(releaseStrategyFactoryBean.getObject());
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
CorrelationStrategyFactoryBean correlationStrategyFactoryBean = new CorrelationStrategyFactoryBean();
|
||||
correlationStrategyFactoryBean.setTarget(target);
|
||||
correlationStrategyFactoryBean.afterPropertiesSet();
|
||||
ReleaseStrategyFactoryBean releaseStrategyFactoryBean = new ReleaseStrategyFactoryBean();
|
||||
releaseStrategyFactoryBean.setTarget(target);
|
||||
releaseStrategyFactoryBean.afterPropertiesSet();
|
||||
return correlationStrategy(correlationStrategyFactoryBean.getObject())
|
||||
.releaseStrategy(releaseStrategyFactoryBean.getObject());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,16 +212,11 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
|
||||
* @see AbstractCorrelatingMessageHandler#setCorrelationStrategy(CorrelationStrategy)
|
||||
*/
|
||||
public S correlationStrategy(Object target, String methodName) {
|
||||
try {
|
||||
CorrelationStrategyFactoryBean correlationStrategyFactoryBean = new CorrelationStrategyFactoryBean();
|
||||
correlationStrategyFactoryBean.setTarget(target);
|
||||
correlationStrategyFactoryBean.setMethodName(methodName);
|
||||
correlationStrategyFactoryBean.afterPropertiesSet();
|
||||
return correlationStrategy(correlationStrategyFactoryBean.getObject());
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
CorrelationStrategyFactoryBean correlationStrategyFactoryBean = new CorrelationStrategyFactoryBean();
|
||||
correlationStrategyFactoryBean.setTarget(target);
|
||||
correlationStrategyFactoryBean.setMethodName(methodName);
|
||||
correlationStrategyFactoryBean.afterPropertiesSet();
|
||||
return correlationStrategy(correlationStrategyFactoryBean.getObject());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -242,7 +232,6 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
|
||||
/**
|
||||
* Configure the handler with an {@link ExpressionEvaluatingReleaseStrategy} for the
|
||||
* given expression.
|
||||
*
|
||||
* @param releaseExpression the correlation expression.
|
||||
* @return the handler spec.
|
||||
* @see AbstractCorrelatingMessageHandler#setReleaseStrategy(ReleaseStrategy)
|
||||
@@ -261,16 +250,11 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
|
||||
* @see AbstractCorrelatingMessageHandler#setReleaseStrategy(ReleaseStrategy)
|
||||
*/
|
||||
public S releaseStrategy(Object target, String methodName) {
|
||||
try {
|
||||
ReleaseStrategyFactoryBean releaseStrategyFactoryBean = new ReleaseStrategyFactoryBean();
|
||||
releaseStrategyFactoryBean.setTarget(target);
|
||||
releaseStrategyFactoryBean.setMethodName(methodName);
|
||||
releaseStrategyFactoryBean.afterPropertiesSet();
|
||||
return releaseStrategy(releaseStrategyFactoryBean.getObject());
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
ReleaseStrategyFactoryBean releaseStrategyFactoryBean = new ReleaseStrategyFactoryBean();
|
||||
releaseStrategyFactoryBean.setTarget(target);
|
||||
releaseStrategyFactoryBean.setMethodName(methodName);
|
||||
releaseStrategyFactoryBean.afterPropertiesSet();
|
||||
return releaseStrategy(releaseStrategyFactoryBean.getObject());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -335,19 +319,6 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
|
||||
return _this();
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure a timeout for old groups in the store to purge.
|
||||
* @param expireTimeout the timeout in milliseconds to use.
|
||||
* @return the endpoint spec.
|
||||
* @since 5.4
|
||||
* @deprecated since 5.5 in favor of {@link #expireTimeout(long)}
|
||||
* @see AbstractCorrelatingMessageHandler#setExpireTimeout(long)
|
||||
*/
|
||||
@Deprecated
|
||||
public S setExpireTimeout(long expireTimeout) {
|
||||
return expireTimeout(expireTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure a timeout for old groups in the store to purge.
|
||||
* @param expireTimeout the timeout in milliseconds to use.
|
||||
@@ -360,19 +331,6 @@ public abstract class CorrelationHandlerSpec<S extends CorrelationHandlerSpec<S,
|
||||
return _this();
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure a {@link Duration} how often to run a scheduled purge task.
|
||||
* @param expireDuration the duration for scheduled purge task.
|
||||
* @return the endpoint spec.
|
||||
* @since 5.4
|
||||
* @deprecated since 5.5 in favor of {@link #expireDuration(Duration)}
|
||||
* @see AbstractCorrelatingMessageHandler#setExpireDuration(Duration)
|
||||
*/
|
||||
@Deprecated
|
||||
public S setExpireDuration(Duration expireDuration) {
|
||||
return expireDuration(expireDuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure a {@link Duration} how often to run a scheduled purge task.
|
||||
* @param expireDuration the duration for scheduled purge task.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018-2020 the original author or authors.
|
||||
* Copyright 2018-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.
|
||||
@@ -19,10 +19,7 @@ package org.springframework.integration.support.management.micrometer;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.ToDoubleFunction;
|
||||
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.integration.support.management.metrics.CounterFacade;
|
||||
import org.springframework.integration.support.management.metrics.GaugeFacade;
|
||||
import org.springframework.integration.support.management.metrics.MeterFacade;
|
||||
@@ -95,38 +92,7 @@ public class MicrometerMetricsCaptor implements MetricsCaptor {
|
||||
return facade.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a MicrometerMetricsCaptor to the context if there's a MeterRegistry; if
|
||||
* there's already a {@link MetricsCaptor} bean, return that.
|
||||
* @param applicationContext the application context.
|
||||
* @return the instance.
|
||||
* @deprecated since 5.2.9 in favor of {@code @Import(MicrometerMetricsCaptorRegistrar.class)};
|
||||
* will be removed in 6.0.
|
||||
*/
|
||||
@Deprecated
|
||||
public static MetricsCaptor loadCaptor(ApplicationContext applicationContext) {
|
||||
try {
|
||||
MeterRegistry registry = applicationContext.getBean(MeterRegistry.class);
|
||||
if (applicationContext instanceof GenericApplicationContext
|
||||
&& !applicationContext.containsBean(MICROMETER_CAPTOR_NAME)) {
|
||||
((GenericApplicationContext) applicationContext).registerBean(MICROMETER_CAPTOR_NAME,
|
||||
MicrometerMetricsCaptor.class,
|
||||
() -> new MicrometerMetricsCaptor(registry));
|
||||
}
|
||||
return applicationContext.getBean(MICROMETER_CAPTOR_NAME, MetricsCaptor.class);
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class MicroSample implements SampleFacade {
|
||||
|
||||
private final Timer.Sample sample;
|
||||
|
||||
MicroSample(Timer.Sample sample) {
|
||||
this.sample = sample;
|
||||
}
|
||||
private record MicroSample(Timer.Sample sample) implements SampleFacade {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2021 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.util;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Chained utility methods to simplify some Java repetitive code. Obtain a reference to
|
||||
* the singleton {@link #INSTANCE} and then chain calls to the utility methods.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 5.1.3
|
||||
*
|
||||
* @deprecated since 5.5.6 in favor of {@link org.springframework.integration.JavaUtils}.
|
||||
*/
|
||||
@Deprecated
|
||||
public final class JavaUtils {
|
||||
|
||||
/**
|
||||
* The singleton instance of this utility class.
|
||||
*/
|
||||
public static final JavaUtils INSTANCE = new JavaUtils();
|
||||
|
||||
private JavaUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke {@link Consumer#accept(Object)} with the value if the condition is true.
|
||||
* @param condition the condition.
|
||||
* @param value the value.
|
||||
* @param consumer the consumer.
|
||||
* @param <T> the value type.
|
||||
* @return this.
|
||||
*/
|
||||
public <T> JavaUtils acceptIfCondition(boolean condition, T value, Consumer<T> consumer) {
|
||||
if (condition) {
|
||||
consumer.accept(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke {@link Consumer#accept(Object)} with the value if it is not null.
|
||||
* @param value the value.
|
||||
* @param consumer the consumer.
|
||||
* @param <T> the value type.
|
||||
* @return this.
|
||||
*/
|
||||
public <T> JavaUtils acceptIfNotNull(T value, Consumer<T> consumer) {
|
||||
if (value != null) {
|
||||
consumer.accept(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke {@link Consumer#accept(Object)} with the value if it is not null or empty.
|
||||
* @param value the value.
|
||||
* @param consumer the consumer.
|
||||
* @return this.
|
||||
* @since 5.2
|
||||
*/
|
||||
public JavaUtils acceptIfHasText(String value, Consumer<String> consumer) {
|
||||
if (StringUtils.hasText(value)) {
|
||||
consumer.accept(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke {@link Consumer#accept(Object)} with the value if it is not null or empty.
|
||||
* @param value the value.
|
||||
* @param consumer the consumer.
|
||||
* @param <T> the value type.
|
||||
* @return this.
|
||||
* @since 5.2
|
||||
*/
|
||||
public <T> JavaUtils acceptIfNotEmpty(List<T> value, Consumer<List<T>> consumer) {
|
||||
if (!CollectionUtils.isEmpty(value)) {
|
||||
consumer.accept(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke {@link Consumer#accept(Object)} with the value if it is not null or empty.
|
||||
* @param value the value.
|
||||
* @param consumer the consumer.
|
||||
* @param <T> the value type.
|
||||
* @return this.
|
||||
* @since 5.2
|
||||
*/
|
||||
public <T> JavaUtils acceptIfNotEmpty(T[] value, Consumer<T[]> consumer) {
|
||||
if (!ObjectUtils.isEmpty(value)) {
|
||||
consumer.accept(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke {@link BiConsumer#accept(Object, Object)} with the arguments if the
|
||||
* condition is true.
|
||||
* @param condition the condition.
|
||||
* @param t1 the first consumer argument
|
||||
* @param t2 the second consumer argument
|
||||
* @param consumer the consumer.
|
||||
* @param <T1> the first argument type.
|
||||
* @param <T2> the second argument type.
|
||||
* @return this.
|
||||
* @since 5.2
|
||||
*/
|
||||
public <T1, T2> JavaUtils acceptIfCondition(boolean condition, T1 t1, T2 t2, BiConsumer<T1, T2> consumer) {
|
||||
if (condition) {
|
||||
consumer.accept(t1, t2);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke {@link BiConsumer#accept(Object, Object)} with the arguments if the t2
|
||||
* argument is not null.
|
||||
* @param t1 the first argument
|
||||
* @param t2 the second consumer argument
|
||||
* @param consumer the consumer.
|
||||
* @param <T1> the first argument type.
|
||||
* @param <T2> the second argument type.
|
||||
* @return this.
|
||||
* @since 5.2
|
||||
*/
|
||||
public <T1, T2> JavaUtils acceptIfNotNull(T1 t1, T2 t2, BiConsumer<T1, T2> consumer) {
|
||||
if (t2 != null) {
|
||||
consumer.accept(t1, t2);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke {@link BiConsumer#accept(Object, Object)} with the arguments if the value
|
||||
* argument is not null or empty.
|
||||
* @param t1 the first consumer argument.
|
||||
* @param value the second consumer argument
|
||||
* @param <T> the first argument type.
|
||||
* @param consumer the consumer.
|
||||
* @return this.
|
||||
* @since 5.2
|
||||
*/
|
||||
public <T> JavaUtils acceptIfHasText(T t1, String value, BiConsumer<T, String> consumer) {
|
||||
if (StringUtils.hasText(value)) {
|
||||
consumer.accept(t1, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
* Copyright 2015-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.
|
||||
@@ -59,17 +59,6 @@ public class DefaultSessionFactoryLocator<F> implements SessionFactoryLocator<F>
|
||||
this.defaultFactory = defaultFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a session factory.
|
||||
* @param key the lookup key.
|
||||
* @param factory the factory.
|
||||
* @deprecated since 5.3 in favor of {@link #addSessionFactory(Object, SessionFactory)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void addSessionFactory(String key, SessionFactory<F> factory) {
|
||||
addSessionFactory((Object) key, factory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a session factory.
|
||||
* @param key the lookup key.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-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.
|
||||
@@ -108,31 +108,6 @@ public final class Ftp {
|
||||
return outboundAdapter(new FtpRemoteFileTemplate(sessionFactory), fileExistsMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link FtpMessageHandlerSpec} factory for an outbound channel adapter spec.
|
||||
* @param remoteFileTemplate the remote file template.
|
||||
* @return the spec.
|
||||
* @deprecated in favor of {@link #outboundAdapter(FtpRemoteFileTemplate)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static FtpMessageHandlerSpec outboundAdapter(RemoteFileTemplate<FTPFile> remoteFileTemplate) {
|
||||
return new FtpMessageHandlerSpec(remoteFileTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link FtpMessageHandlerSpec} factory for an outbound channel adapter spec.
|
||||
* @param remoteFileTemplate the remote file template.
|
||||
* @param fileExistsMode the file exists mode.
|
||||
* @return the spec.
|
||||
* @deprecated in favor of {@link #outboundAdapter(FtpRemoteFileTemplate, FileExistsMode)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static FtpMessageHandlerSpec outboundAdapter(RemoteFileTemplate<FTPFile> remoteFileTemplate,
|
||||
FileExistsMode fileExistsMode) {
|
||||
|
||||
return new FtpMessageHandlerSpec(remoteFileTemplate, fileExistsMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link FtpMessageHandlerSpec} factory for an outbound channel adapter spec.
|
||||
* @param ftpRemoteFileTemplate the remote file template.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-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.
|
||||
@@ -19,7 +19,6 @@ package org.springframework.integration.ftp.dsl;
|
||||
import org.apache.commons.net.ftp.FTPFile;
|
||||
|
||||
import org.springframework.integration.file.dsl.FileTransferringMessageHandlerSpec;
|
||||
import org.springframework.integration.file.remote.RemoteFileTemplate;
|
||||
import org.springframework.integration.file.remote.session.SessionFactory;
|
||||
import org.springframework.integration.file.support.FileExistsMode;
|
||||
import org.springframework.integration.ftp.outbound.FtpMessageHandler;
|
||||
@@ -40,16 +39,6 @@ public class FtpMessageHandlerSpec extends FileTransferringMessageHandlerSpec<FT
|
||||
this.target = new FtpMessageHandler(sessionFactory);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected FtpMessageHandlerSpec(RemoteFileTemplate<FTPFile> remoteFileTemplate) {
|
||||
this.target = new FtpMessageHandler(remoteFileTemplate.getSessionFactory());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected FtpMessageHandlerSpec(RemoteFileTemplate<FTPFile> remoteFileTemplate, FileExistsMode fileExistsMode) {
|
||||
this.target = new FtpMessageHandler(remoteFileTemplate, fileExistsMode);
|
||||
}
|
||||
|
||||
protected FtpMessageHandlerSpec(FtpRemoteFileTemplate ftpRemoteFileTemplate) {
|
||||
this.target = new FtpMessageHandler(ftpRemoteFileTemplate);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2019 the original author or authors.
|
||||
* Copyright 2016-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.
|
||||
@@ -37,6 +37,7 @@ import org.springframework.integration.ftp.session.FtpRemoteFileTemplate;
|
||||
* @author Deepak Gunasekaran
|
||||
*
|
||||
* @since 4.1.9
|
||||
*
|
||||
* @see FtpRemoteFileTemplate
|
||||
*/
|
||||
public class FtpMessageHandler extends FileTransferringMessageHandler<FTPFile> {
|
||||
@@ -50,18 +51,6 @@ public class FtpMessageHandler extends FileTransferringMessageHandler<FTPFile> {
|
||||
super(remoteFileTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which sets the RemoteFileTemplate and FileExistsMode.
|
||||
* @param remoteFileTemplate the remote file template.
|
||||
* @param mode the file exists mode.
|
||||
* @deprecated in favor of
|
||||
* {@link #FtpMessageHandler(FtpRemoteFileTemplate, FileExistsMode)}
|
||||
*/
|
||||
@Deprecated
|
||||
public FtpMessageHandler(RemoteFileTemplate<FTPFile> remoteFileTemplate, FileExistsMode mode) {
|
||||
super(remoteFileTemplate, mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which sets the FtpRemoteFileTemplate and FileExistsMode.
|
||||
* @param ftpRemoteFileTemplate the remote file template.
|
||||
|
||||
@@ -21,7 +21,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
@@ -29,8 +28,7 @@ import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -43,8 +41,7 @@ import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
/**
|
||||
* @author Gary Russell
|
||||
@@ -54,8 +51,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
* @since 2.1
|
||||
*
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext
|
||||
public class CookieTests {
|
||||
|
||||
@@ -65,9 +61,9 @@ public class CookieTests {
|
||||
@Autowired
|
||||
private QueueChannel ch6;
|
||||
|
||||
private static ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
private static final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
|
||||
private static List<HttpHeaders> allHeaders = new ArrayList<>();
|
||||
private static final List<HttpHeaders> allHeaders = new ArrayList<>();
|
||||
|
||||
@Test
|
||||
public void testCookie() throws Exception {
|
||||
@@ -93,8 +89,7 @@ public class CookieTests {
|
||||
|
||||
private int count = 123;
|
||||
|
||||
public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod)
|
||||
throws IOException {
|
||||
public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) {
|
||||
|
||||
return new ClientHttpRequest() {
|
||||
|
||||
@@ -104,7 +99,7 @@ public class CookieTests {
|
||||
return headers;
|
||||
}
|
||||
|
||||
public OutputStream getBody() throws IOException {
|
||||
public OutputStream getBody() {
|
||||
return bos;
|
||||
}
|
||||
|
||||
@@ -122,7 +117,7 @@ public class CookieTests {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ClientHttpResponse execute() throws IOException {
|
||||
public ClientHttpResponse execute() {
|
||||
allHeaders.add(headers);
|
||||
return new ClientHttpResponse() {
|
||||
|
||||
@@ -134,22 +129,22 @@ public class CookieTests {
|
||||
return headers;
|
||||
}
|
||||
|
||||
public InputStream getBody() throws IOException {
|
||||
public InputStream getBody() {
|
||||
return new ByteArrayInputStream("OK".getBytes());
|
||||
}
|
||||
|
||||
public String getStatusText() throws IOException {
|
||||
public String getStatusText() {
|
||||
return "OK";
|
||||
}
|
||||
|
||||
public HttpStatus getStatusCode() throws IOException {
|
||||
public HttpStatus getStatusCode() {
|
||||
return HttpStatus.OK;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
}
|
||||
|
||||
public int getRawStatusCode() throws IOException {
|
||||
public int getRawStatusCode() {
|
||||
return 200;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.integration.jdbc;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -103,7 +104,7 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean {
|
||||
private List<SqlParameter> sqlParameters = new ArrayList<>(0);
|
||||
|
||||
/**
|
||||
* By default bean properties of the passed in {@link Message} will be used
|
||||
* By default, bean properties of the passed in {@link Message} will be used
|
||||
* as a source for the Stored Procedure's input parameters. By default a
|
||||
* {@link BeanPropertySqlParameterSourceFactory} will be used.
|
||||
* This may be sufficient for basic use cases. For more sophisticated options
|
||||
@@ -191,9 +192,9 @@ public class StoredProcExecutor implements BeanFactoryAware, InitializingBean {
|
||||
}
|
||||
|
||||
private Map<String, SimpleJdbcCallOperations> buildJdbcCallOperationsMap() {
|
||||
return new LinkedHashMap<String, SimpleJdbcCallOperations>(this.jdbcCallOperationsCacheSize + 1, LOAD_FACTOR,
|
||||
true) {
|
||||
return new LinkedHashMap<>(this.jdbcCallOperationsCacheSize + 1, LOAD_FACTOR, true) {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3801124242820219131L;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -203,7 +203,7 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
|
||||
/**
|
||||
* The {@link org.springframework.jdbc.core.JdbcOperations}
|
||||
* to use when interacting with the database. Either
|
||||
* to use when interacting with the database. Either
|
||||
* this property can be set or the {@link #setDataSource(DataSource) dataSource}.
|
||||
* Please consider passing in a {@link JdbcTemplate} with a fetchSize property
|
||||
* of 1. This is particularly important for Oracle to ensure First In, First Out (FIFO)
|
||||
@@ -457,8 +457,8 @@ public class JdbcChannelMessageStore implements PriorityCapableChannelMessageSto
|
||||
|
||||
/**
|
||||
* Replace patterns in the input to produce a valid SQL query. This implementation lazily initializes a
|
||||
* simple map-based cache, only replacing the table prefix on the first access to a named query. Further
|
||||
* accesses will be resolved from the cache.
|
||||
* simple map-based cache, only replacing the table prefix on the first access to a named query.
|
||||
* Subsequent accesses will be resolved from the cache.
|
||||
* @param queryName The {@link Query} to be transformed.
|
||||
* @param queryProvider a supplier to provide the query template.
|
||||
* @return A transformed query with replacements.
|
||||
|
||||
@@ -566,7 +566,7 @@ public class JdbcMessageStore extends AbstractMessageGroupStore implements Messa
|
||||
new SingleColumnRowMapper<String>(), this.region)
|
||||
.iterator();
|
||||
|
||||
return new Iterator<MessageGroup>() {
|
||||
return new Iterator<>() {
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -392,8 +392,8 @@ public class ChannelPublishingJmsMessageListener
|
||||
this.gatewayDelegate.stop();
|
||||
}
|
||||
|
||||
private void copyCorrelationIdFromRequestToReply(jakarta.jms.Message requestMessage, jakarta.jms.Message replyMessage)
|
||||
throws JMSException {
|
||||
private void copyCorrelationIdFromRequestToReply(jakarta.jms.Message requestMessage,
|
||||
jakarta.jms.Message replyMessage) throws JMSException {
|
||||
|
||||
if (this.correlationKey != null) {
|
||||
if (this.correlationKey.equals("JMSCorrelationID")) {
|
||||
@@ -417,9 +417,8 @@ public class ChannelPublishingJmsMessageListener
|
||||
|
||||
/**
|
||||
* Determine a reply destination for the given message.
|
||||
* <p>
|
||||
* This implementation first checks the boolean 'error' flag which signifies that the reply is an error message. If
|
||||
* reply is not an error it will first check the JMS Reply-To {@link Destination} of the supplied request message;
|
||||
* <p> This implementation first checks the boolean 'error' flag which signifies that the reply is an error message.
|
||||
* If reply is not an error it will first check the JMS Reply-To {@link Destination} of the supplied request message;
|
||||
* if that is not <code>null</code> it is returned; if it is <code>null</code>, then the configured
|
||||
* {@link #resolveDefaultReplyDestination default reply destination} is returned; if this too is <code>null</code>,
|
||||
* then an {@link InvalidDestinationException} is thrown.
|
||||
@@ -458,8 +457,7 @@ public class ChannelPublishingJmsMessageListener
|
||||
if (this.defaultReplyDestination instanceof Destination) {
|
||||
return (Destination) this.defaultReplyDestination;
|
||||
}
|
||||
if (this.defaultReplyDestination instanceof DestinationNameHolder) {
|
||||
DestinationNameHolder nameHolder = (DestinationNameHolder) this.defaultReplyDestination;
|
||||
if (this.defaultReplyDestination instanceof DestinationNameHolder nameHolder) {
|
||||
return this.destinationResolver.resolveDestinationName(session, nameHolder.name, nameHolder.isTopic);
|
||||
}
|
||||
return null;
|
||||
@@ -486,16 +484,7 @@ public class ChannelPublishingJmsMessageListener
|
||||
* Internal class combining a destination name
|
||||
* and its target destination type (queue or topic).
|
||||
*/
|
||||
private static final class DestinationNameHolder {
|
||||
|
||||
private final String name;
|
||||
|
||||
private final boolean isTopic;
|
||||
|
||||
DestinationNameHolder(String name, boolean isTopic) {
|
||||
this.name = name;
|
||||
this.isTopic = isTopic;
|
||||
}
|
||||
private record DestinationNameHolder(String name, boolean isTopic) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.integration.jms;
|
||||
|
||||
import jakarta.jms.Destination;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.expression.EvaluationContext;
|
||||
import org.springframework.expression.Expression;
|
||||
@@ -60,6 +61,7 @@ public class JmsSendingMessageHandler extends AbstractMessageHandler {
|
||||
|
||||
|
||||
public JmsSendingMessageHandler(JmsTemplate jmsTemplate) {
|
||||
Assert.notNull(jmsTemplate, "'jmsTemplate' must not be null");
|
||||
this.jmsTemplate = jmsTemplate;
|
||||
}
|
||||
|
||||
@@ -145,14 +147,15 @@ public class JmsSendingMessageHandler extends AbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
protected void onInit() {
|
||||
BeanFactory beanFactory = getBeanFactory();
|
||||
if (this.destinationExpressionProcessor != null) {
|
||||
this.destinationExpressionProcessor.setBeanFactory(getBeanFactory());
|
||||
this.destinationExpressionProcessor.setBeanFactory(beanFactory);
|
||||
ConversionService conversionService = getConversionService();
|
||||
if (conversionService != null) {
|
||||
this.destinationExpressionProcessor.setConversionService(conversionService);
|
||||
}
|
||||
}
|
||||
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
|
||||
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(beanFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -201,7 +204,8 @@ public class JmsSendingMessageHandler extends AbstractMessageHandler {
|
||||
Object result = this.destinationExpressionProcessor.processMessage(message);
|
||||
if (!(result instanceof Destination || result instanceof String)) {
|
||||
throw new MessageDeliveryException(message,
|
||||
"Evaluation of destinationExpression failed to produce a Destination or destination name. Result was: " + result);
|
||||
"Evaluation of destinationExpression failed to produce a Destination or destination name. " +
|
||||
"Result was: " + result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -221,16 +225,8 @@ public class JmsSendingMessageHandler extends AbstractMessageHandler {
|
||||
}
|
||||
|
||||
|
||||
private static final class HeaderMappingMessagePostProcessor implements MessagePostProcessor {
|
||||
|
||||
private final Message<?> integrationMessage;
|
||||
|
||||
private final JmsHeaderMapper headerMapper;
|
||||
|
||||
HeaderMappingMessagePostProcessor(Message<?> integrationMessage, JmsHeaderMapper headerMapper) {
|
||||
this.integrationMessage = integrationMessage;
|
||||
this.headerMapper = headerMapper;
|
||||
}
|
||||
private record HeaderMappingMessagePostProcessor(Message<?> integrationMessage, JmsHeaderMapper headerMapper)
|
||||
implements MessagePostProcessor {
|
||||
|
||||
@Override
|
||||
public jakarta.jms.Message postProcessMessage(jakarta.jms.Message jmsMessage) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2019 the original author or authors.
|
||||
* Copyright 2016-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.
|
||||
@@ -16,18 +16,24 @@
|
||||
|
||||
package org.springframework.integration.jms;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import org.springframework.jms.JmsException;
|
||||
|
||||
/**
|
||||
* A timeout occurred within an async gateway.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 4.3
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class JmsTimeoutException extends JmsException {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 5439915454935047936L;
|
||||
|
||||
public JmsTimeoutException(String description) {
|
||||
super(description);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2021 the original author or authors.
|
||||
* Copyright 2016-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.
|
||||
@@ -209,17 +209,6 @@ public class JmsInboundGatewaySpec<S extends JmsInboundGatewaySpec<S>>
|
||||
this.spec.get().setAutoStartup(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param destination the destination
|
||||
* @return the spec.
|
||||
* @deprecated since 5.5 in favor of {@link #requestDestination(Destination)}
|
||||
* @see JmsListenerContainerSpec#destination(Destination)
|
||||
*/
|
||||
@Deprecated
|
||||
public JmsInboundGatewayListenerContainerSpec<S, C> destination(Destination destination) {
|
||||
return requestDestination(destination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a request destination for incoming messages.
|
||||
* @param requestDestination the destination
|
||||
@@ -232,17 +221,6 @@ public class JmsInboundGatewaySpec<S extends JmsInboundGatewaySpec<S>>
|
||||
return _this();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param destinationName the destinationName
|
||||
* @return the spec.
|
||||
* @deprecated since 5.5 in favor of {@link #requestDestination(String)}
|
||||
* @see JmsListenerContainerSpec#destination(String)
|
||||
*/
|
||||
@Deprecated
|
||||
public JmsInboundGatewayListenerContainerSpec<S, C> destination(String destinationName) {
|
||||
return requestDestination(destinationName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a request destination for incoming messages.
|
||||
* @param requestDestinationName the destination name
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -242,8 +242,7 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
}
|
||||
|
||||
private void populateMessageHandlers() {
|
||||
Map<String, MessageHandler> messageHandlers = this.applicationContext
|
||||
.getBeansOfType(MessageHandler.class);
|
||||
Map<String, MessageHandler> messageHandlers = this.applicationContext.getBeansOfType(MessageHandler.class);
|
||||
for (Entry<String, MessageHandler> entry : messageHandlers.entrySet()) {
|
||||
|
||||
String beanName = entry.getKey();
|
||||
@@ -264,8 +263,7 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
}
|
||||
|
||||
private void populateMessageSources() {
|
||||
this.applicationContext.getBeansOfType(
|
||||
IntegrationInboundManagement.class)
|
||||
this.applicationContext.getBeansOfType(IntegrationInboundManagement.class)
|
||||
.values()
|
||||
.stream()
|
||||
// If the source is proxied, we have to extract the target to expose as an MBean.
|
||||
@@ -332,8 +330,7 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
}
|
||||
|
||||
private void postProcessAbstractEndpoint(Object bean) {
|
||||
if (bean instanceof IntegrationConsumer) {
|
||||
IntegrationConsumer integrationConsumer = (IntegrationConsumer) bean;
|
||||
if (bean instanceof IntegrationConsumer integrationConsumer) {
|
||||
MessageHandler handler = integrationConsumer.getHandler();
|
||||
MessageHandler monitor = (MessageHandler) extractTarget(handler);
|
||||
if (monitor instanceof IntegrationManagement) {
|
||||
@@ -344,8 +341,7 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (bean instanceof SourcePollingChannelAdapter) {
|
||||
SourcePollingChannelAdapter pollingChannelAdapter = (SourcePollingChannelAdapter) bean;
|
||||
else if (bean instanceof SourcePollingChannelAdapter pollingChannelAdapter) {
|
||||
MessageSource<?> messageSource = pollingChannelAdapter.getMessageSource();
|
||||
if (messageSource instanceof IntegrationInboundManagement) {
|
||||
IntegrationInboundManagement monitor = (IntegrationInboundManagement) extractTarget(messageSource);
|
||||
@@ -388,14 +384,14 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
else {
|
||||
|
||||
this.endpointsByMonitor.remove(bean);
|
||||
if (bean instanceof IntegrationManagement) {
|
||||
if (bean instanceof IntegrationManagement && bean instanceof MessageChannel) {
|
||||
this.channels.remove(((NamedComponent) bean).getComponentName());
|
||||
}
|
||||
else if (bean instanceof IntegrationManagement) {
|
||||
else if (bean instanceof IntegrationManagement && bean instanceof MessageHandler) {
|
||||
this.handlers.remove(((NamedComponent) bean).getComponentName());
|
||||
this.endpointNames.remove(((NamedComponent) bean).getComponentName());
|
||||
}
|
||||
else if (bean instanceof IntegrationInboundManagement) {
|
||||
else if (bean instanceof IntegrationInboundManagement && bean instanceof MessageSource) {
|
||||
this.sources.remove(((NamedComponent) bean).getComponentName());
|
||||
this.endpointNames.remove(((NamedComponent) bean).getComponentName());
|
||||
}
|
||||
@@ -428,7 +424,7 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
* Copy of private method in super class. Needed so we can avoid using the bean factory to extract the bean again,
|
||||
* and risk it being a proxy (which it almost certainly is by now).
|
||||
* @param bean the bean instance to register
|
||||
* @param beanKey the bean name or human readable version if auto-generated
|
||||
* @param beanKey the bean name or human-readable version if auto-generated
|
||||
* @return the JMX object name of the MBean that was registered
|
||||
*/
|
||||
private ObjectName registerBeanInstance(Object bean, String beanKey) {
|
||||
@@ -550,12 +546,11 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
public void stopActiveChannels() {
|
||||
// Stop any "active" channels (JMS etc).
|
||||
for (IntegrationManagement metrics : this.channels.values()) {
|
||||
IntegrationManagement channel = metrics;
|
||||
if (channel instanceof Lifecycle) {
|
||||
if (metrics instanceof Lifecycle) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Stopping channel " + channel);
|
||||
logger.info("Stopping channel " + metrics);
|
||||
}
|
||||
((Lifecycle) channel).stop();
|
||||
((Lifecycle) metrics).stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -604,20 +599,8 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
@ManagedAttribute
|
||||
public String[] getHandlerNames() {
|
||||
return this.handlers.values().stream()
|
||||
.map(hand -> hand.getManagedName())
|
||||
.toArray(n -> new String[n]);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "No longer supported")
|
||||
public int getActiveHandlerCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "No longer supported")
|
||||
public long getActiveHandlerCountLong() {
|
||||
return 0;
|
||||
.map(IntegrationManagement::getManagedName)
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
|
||||
@ManagedMetric(metricType = MetricType.GAUGE, displayName = "Queued Message Count")
|
||||
@@ -631,14 +614,7 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
|
||||
@ManagedAttribute
|
||||
public String[] getChannelNames() {
|
||||
return this.channels.keySet().stream()
|
||||
.toArray(n -> new String[n]);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Deprecated
|
||||
public AbstractMessageHandler getHandlerMetrics(String name) {
|
||||
return null;
|
||||
return this.channels.keySet().toArray(String[]::new);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -648,18 +624,7 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
|
||||
@ManagedAttribute
|
||||
public String[] getSourceNames() {
|
||||
return this.sources.keySet().stream()
|
||||
.toArray(n -> new String[n]);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public IntegrationInboundManagement getSourceMetrics(String name) {
|
||||
return this.sources.get(name);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public IntegrationManagement getChannelMetrics(String name) {
|
||||
return this.channels.get(name);
|
||||
return this.sources.keySet().toArray(String[]::new);
|
||||
}
|
||||
|
||||
public IntegrationInboundManagement getSource(String name) {
|
||||
@@ -732,7 +697,7 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
private void registerEndpoints() {
|
||||
String[] names = this.applicationContext.getBeanNamesForType(AbstractEndpoint.class);
|
||||
for (String name : names) {
|
||||
if (!this.endpointsByMonitor.values().contains(name)) {
|
||||
if (!this.endpointsByMonitor.containsValue(name)) {
|
||||
AbstractEndpoint endpoint = this.applicationContext.getBean(name, AbstractEndpoint.class);
|
||||
registerEndpoint(endpoint);
|
||||
}
|
||||
@@ -778,14 +743,13 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
*/
|
||||
private boolean matches(String[] patterns, String name) {
|
||||
Boolean match = PatternMatchUtils.smartMatch(name, patterns);
|
||||
return match == null ? false : match;
|
||||
return match != null && match;
|
||||
}
|
||||
|
||||
private Object extractTarget(Object bean) {
|
||||
if (!(bean instanceof Advised)) {
|
||||
if (!(bean instanceof Advised advised)) {
|
||||
return bean;
|
||||
}
|
||||
Advised advised = (Advised) bean;
|
||||
try {
|
||||
return extractTarget(advised.getTargetSource().getTarget());
|
||||
}
|
||||
@@ -824,7 +788,6 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
|
||||
/*
|
||||
* https://www.oracle.com/technetwork/java/javase/tech/best-practices-jsp-136021.html
|
||||
*
|
||||
* The set of characters in a value is also limited. If special characters may
|
||||
* occur, it is recommended that the value be quoted, using ObjectName.quote. If
|
||||
* the value for a given key is sometimes quoted, then it should always be quoted.
|
||||
@@ -890,7 +853,6 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
IntegrationManagement monitor2,
|
||||
String name, String source, IntegrationConsumer endpoint) {
|
||||
|
||||
IntegrationManagement result = monitor2;
|
||||
String managedType = source;
|
||||
String managedName = name;
|
||||
|
||||
@@ -914,16 +876,16 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
managedType = "handler";
|
||||
}
|
||||
|
||||
result.setManagedType(managedType);
|
||||
result.setManagedName(managedName);
|
||||
return result;
|
||||
monitor2.setManagedType(managedType);
|
||||
monitor2.setManagedName(managedName);
|
||||
return monitor2;
|
||||
}
|
||||
|
||||
private String buildAnonymousManagedName(Map<Object, AtomicLong> anonymousCache, MessageChannel messageChannel) {
|
||||
AtomicLong count = anonymousCache.computeIfAbsent(messageChannel, (key) -> new AtomicLong());
|
||||
long total = count.incrementAndGet();
|
||||
/*
|
||||
* Short hack to makes sure object names are unique if more than one endpoint has the same input
|
||||
* Short hack to make sure object names are unique if more than one endpoint has the same input
|
||||
* channel
|
||||
*/
|
||||
|
||||
@@ -966,9 +928,7 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
return messageSourceMetrics;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unlikely-arg-type")
|
||||
private AbstractEndpoint getEndpointForMonitor(IntegrationInboundManagement source2) {
|
||||
|
||||
for (AbstractEndpoint endpoint : this.applicationContext.getBeansOfType(AbstractEndpoint.class).values()) {
|
||||
Object target = null;
|
||||
if (source2 instanceof MessagingGatewaySupport && endpoint.equals(source2)) {
|
||||
@@ -988,7 +948,6 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
IntegrationInboundManagement source2, String name,
|
||||
String source, Object endpoint) {
|
||||
|
||||
IntegrationInboundManagement result = source2;
|
||||
String managedType = source;
|
||||
String managedName = name;
|
||||
|
||||
@@ -1019,13 +978,13 @@ public class IntegrationMBeanExporter extends MBeanExporter
|
||||
}
|
||||
|
||||
if (managedName == null) {
|
||||
managedName = result.toString();
|
||||
managedName = source2.toString();
|
||||
managedType = "source";
|
||||
}
|
||||
|
||||
result.setManagedType(managedType);
|
||||
result.setManagedName(managedName);
|
||||
return result;
|
||||
source2.setManagedType(managedType);
|
||||
source2.setManagedName(managedName);
|
||||
return source2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2020 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.monitor;
|
||||
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.integration.endpoint.AbstractEndpoint;
|
||||
import org.springframework.integration.support.management.IntegrationManagedResource;
|
||||
import org.springframework.jmx.export.annotation.ManagedAttribute;
|
||||
import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
|
||||
/**
|
||||
* Wrapper for an {@link AbstractEndpoint} that exposes a management interface.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @deprecated this is no longer used by the framework. Replaced by
|
||||
* {@link org.springframework.integration.support.management.ManageableLifecycle}.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
@IntegrationManagedResource
|
||||
public class ManagedEndpoint implements Lifecycle {
|
||||
|
||||
private final AbstractEndpoint delegate;
|
||||
|
||||
public ManagedEndpoint(AbstractEndpoint delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ManagedAttribute
|
||||
public final boolean isRunning() {
|
||||
return this.delegate.isRunning();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ManagedOperation
|
||||
public final void start() {
|
||||
this.delegate.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ManagedOperation
|
||||
public final void stop() {
|
||||
this.delegate.stop();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2020 the original author or authors.
|
||||
* Copyright 2019-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.
|
||||
@@ -29,7 +29,6 @@ import org.springframework.util.MimeType;
|
||||
import io.rsocket.transport.ClientTransport;
|
||||
import io.rsocket.transport.netty.client.TcpClientTransport;
|
||||
import io.rsocket.transport.netty.client.WebsocketClientTransport;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* A client {@link AbstractRSocketConnector} extension to the RSocket connection.
|
||||
@@ -190,16 +189,6 @@ public class ClientRSocketConnector extends AbstractRSocketConnector {
|
||||
this.rsocketRequester.rsocketClient().source().subscribe();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link Mono} for the {@link RSocketRequester}.
|
||||
* @return the {@link Mono} for the {@link RSocketRequester}.
|
||||
* @deprecated since 5.4 in favor of {@link #getRequester()}
|
||||
*/
|
||||
@Deprecated
|
||||
public Mono<RSocketRequester> getRSocketRequester() {
|
||||
return Mono.just(getRequester());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link RSocketRequester} this connector is built on.
|
||||
* @return the {@link RSocketRequester} this connector is built on.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-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.
|
||||
@@ -109,32 +109,6 @@ public final class Sftp {
|
||||
return outboundAdapter(new SftpRemoteFileTemplate(sessionFactory), fileExistsMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* An {@link SftpMessageHandlerSpec} factory for an outbound channel adapter spec.
|
||||
* @param remoteFileTemplate the remote file template.
|
||||
* @return the spec.
|
||||
* @deprecated in favor of {@link #outboundAdapter(SftpRemoteFileTemplate)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static SftpMessageHandlerSpec outboundAdapter(RemoteFileTemplate<ChannelSftp.LsEntry> remoteFileTemplate) {
|
||||
return new SftpMessageHandlerSpec(remoteFileTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* An {@link SftpMessageHandlerSpec} factory for an outbound channel adapter spec.
|
||||
* @param remoteFileTemplate the remote file template.
|
||||
* @param fileExistsMode the file exists mode.
|
||||
* @return the spec.
|
||||
* @deprecated in favor of
|
||||
* {@link #outboundAdapter(SftpRemoteFileTemplate,FileExistsMode)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static SftpMessageHandlerSpec outboundAdapter(RemoteFileTemplate<ChannelSftp.LsEntry> remoteFileTemplate,
|
||||
FileExistsMode fileExistsMode) {
|
||||
|
||||
return new SftpMessageHandlerSpec(remoteFileTemplate, fileExistsMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* An {@link SftpMessageHandlerSpec} factory for an outbound channel adapter spec.
|
||||
* @param sftpRemoteFileTemplate the remote file template.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-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.
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.integration.sftp.dsl;
|
||||
|
||||
import org.springframework.integration.file.dsl.FileTransferringMessageHandlerSpec;
|
||||
import org.springframework.integration.file.remote.RemoteFileTemplate;
|
||||
import org.springframework.integration.file.remote.session.SessionFactory;
|
||||
import org.springframework.integration.file.support.FileExistsMode;
|
||||
import org.springframework.integration.sftp.outbound.SftpMessageHandler;
|
||||
@@ -39,26 +38,11 @@ public class SftpMessageHandlerSpec
|
||||
this.target = new SftpMessageHandler(sessionFactory);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected SftpMessageHandlerSpec(RemoteFileTemplate<ChannelSftp.LsEntry> remoteFileTemplate) {
|
||||
this.target = new SftpMessageHandler(remoteFileTemplate.getSessionFactory());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected SftpMessageHandlerSpec(RemoteFileTemplate<ChannelSftp.LsEntry> remoteFileTemplate,
|
||||
FileExistsMode fileExistsMode) {
|
||||
|
||||
this.target =
|
||||
new SftpMessageHandler(new SftpRemoteFileTemplate(remoteFileTemplate.getSessionFactory()),
|
||||
fileExistsMode);
|
||||
}
|
||||
|
||||
protected SftpMessageHandlerSpec(SftpRemoteFileTemplate sftpRemoteFileTemplate) {
|
||||
this.target = new SftpMessageHandler(sftpRemoteFileTemplate);
|
||||
}
|
||||
|
||||
protected SftpMessageHandlerSpec(SftpRemoteFileTemplate sftpRemoteFileTemplate, FileExistsMode fileExistsMode) {
|
||||
|
||||
this.target = new SftpMessageHandler(sftpRemoteFileTemplate, fileExistsMode);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -27,7 +27,6 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.integration.JavaUtils;
|
||||
import org.springframework.integration.file.remote.session.SessionFactory;
|
||||
@@ -184,21 +183,6 @@ public class DefaultSftpSessionFactory implements SessionFactory<LsEntry>, Share
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the filename that will be used for a host key repository.
|
||||
* The file has the same format as OpenSSH's known_hosts file.
|
||||
* <p>
|
||||
* <b>Required if {@link #setAllowUnknownKeys(boolean) allowUnknownKeys} is
|
||||
* false (default).</b>
|
||||
* @param knownHosts The known hosts.
|
||||
* @deprecated since 5.2.5 in favor of {@link #setKnownHostsResource(Resource)}
|
||||
* @see JSch#setKnownHosts(String)
|
||||
*/
|
||||
@Deprecated
|
||||
public void setKnownHosts(String knownHosts) {
|
||||
setKnownHostsResource(new FileSystemResource(knownHosts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the filename that will be used for a host key repository.
|
||||
* The file has the same format as OpenSSH's known_hosts file.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -26,6 +26,8 @@ import com.jcraft.jsch.SftpATTRS;
|
||||
* A {@link org.springframework.integration.file.remote.FileInfo} implementation for SFTP.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
public class SftpFileInfo extends AbstractFileInfo<LsEntry> {
|
||||
@@ -42,7 +44,7 @@ public class SftpFileInfo extends AbstractFileInfo<LsEntry> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.jcraft.jsch.SftpATTRS#isDir()
|
||||
* @see SftpATTRS#isDir()
|
||||
*/
|
||||
@Override
|
||||
public boolean isDirectory() {
|
||||
@@ -50,7 +52,7 @@ public class SftpFileInfo extends AbstractFileInfo<LsEntry> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.jcraft.jsch.SftpATTRS#isLink()
|
||||
* @see SftpATTRS#isLink()
|
||||
*/
|
||||
@Override
|
||||
public boolean isLink() {
|
||||
@@ -58,7 +60,7 @@ public class SftpFileInfo extends AbstractFileInfo<LsEntry> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.jcraft.jsch.SftpATTRS#getSize()
|
||||
* @see SftpATTRS#getSize()
|
||||
*/
|
||||
@Override
|
||||
public long getSize() {
|
||||
@@ -66,7 +68,7 @@ public class SftpFileInfo extends AbstractFileInfo<LsEntry> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.jcraft.jsch.SftpATTRS#getMTime()
|
||||
* @see SftpATTRS#getMTime()
|
||||
*/
|
||||
@Override
|
||||
public long getModified() {
|
||||
@@ -74,7 +76,7 @@ public class SftpFileInfo extends AbstractFileInfo<LsEntry> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.jcraft.jsch.ChannelSftp.LsEntry#getFilename()
|
||||
* @see LsEntry#getFilename()
|
||||
*/
|
||||
@Override
|
||||
public String getFilename() {
|
||||
|
||||
@@ -1,550 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2021 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.test.mail;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import javax.net.ServerSocketFactory;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.util.Base64Utils;
|
||||
|
||||
/**
|
||||
* A basic test mail server for pop3, imap,
|
||||
* Serves up a canned email message with each protocol.
|
||||
* For smtp, it handles the basic handshaking and captures
|
||||
* the pertinent data so it can be verified by a test case.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 5.0
|
||||
*
|
||||
* @deprecated since 5.5 in favor of GreenMail library for mail testing.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public final class TestMailServer {
|
||||
|
||||
public static SmtpServer smtp(int port) {
|
||||
try {
|
||||
return new SmtpServer(port);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Pop3Server pop3(int port) {
|
||||
try {
|
||||
return new Pop3Server(port);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static ImapServer imap(int port) {
|
||||
try {
|
||||
return new ImapServer(port);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SmtpServer extends MailServer {
|
||||
|
||||
SmtpServer(int port) throws IOException {
|
||||
super(port);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MailHandler mailHandler(Socket socket) {
|
||||
return new SmtpHandler(socket);
|
||||
}
|
||||
|
||||
class SmtpHandler extends MailHandler {
|
||||
|
||||
SmtpHandler(Socket socket) {
|
||||
super(socket);
|
||||
}
|
||||
|
||||
@Override // NOSONAR
|
||||
void doRun() { // NOSONAR
|
||||
try {
|
||||
write("220 foo SMTP");
|
||||
while (!socket.isClosed()) {
|
||||
String line = reader.readLine();
|
||||
if (line == null) {
|
||||
break;
|
||||
}
|
||||
if (line.contains("EHLO")) {
|
||||
write("250-foo hello [0,0,0,0], foo");
|
||||
write("250-AUTH LOGIN PLAIN");
|
||||
write("250 OK");
|
||||
}
|
||||
else if (line.contains("MAIL FROM")) {
|
||||
write("250 OK");
|
||||
}
|
||||
else if (line.contains("RCPT TO")) {
|
||||
write("250 OK");
|
||||
}
|
||||
else if (line.contains("AUTH LOGIN")) {
|
||||
write("334 VXNlcm5hbWU6");
|
||||
}
|
||||
else if (line.contains("dXNlcg==")) { // base64 'user'
|
||||
sb.append("user:");
|
||||
sb.append((new String(Base64Utils.decode(line.getBytes()))));
|
||||
sb.append("\n");
|
||||
write("334 UGFzc3dvcmQ6");
|
||||
}
|
||||
else if (line.contains("cHc=")) { // base64 'pw'
|
||||
sb.append("password:");
|
||||
sb.append((new String(Base64Utils.decode(line.getBytes()))));
|
||||
sb.append("\n");
|
||||
write("235");
|
||||
}
|
||||
else if (line.equals("DATA")) {
|
||||
write("354");
|
||||
}
|
||||
else if (line.equals(".")) {
|
||||
write("250");
|
||||
}
|
||||
else if (line.equals("QUIT")) {
|
||||
write("221");
|
||||
socket.close();
|
||||
}
|
||||
else {
|
||||
sb.append(line);
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
messages.add(sb.toString());
|
||||
}
|
||||
catch (IOException e) {
|
||||
if (!this.stopped) {
|
||||
LOGGER.error(IO_EXCEPTION, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Pop3Server extends MailServer {
|
||||
|
||||
Pop3Server(int port) throws IOException {
|
||||
super(port);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MailHandler mailHandler(Socket socket) {
|
||||
return new Pop3Handler(socket);
|
||||
}
|
||||
|
||||
class Pop3Handler extends MailHandler {
|
||||
|
||||
private static final String PLUS_OK = "+OK";
|
||||
|
||||
Pop3Handler(Socket socket) {
|
||||
super(socket);
|
||||
}
|
||||
|
||||
@Override // NOSONAR
|
||||
void doRun() {
|
||||
try {
|
||||
write("+OK POP3");
|
||||
while (!socket.isClosed()) {
|
||||
String line = reader.readLine();
|
||||
if (line == null) {
|
||||
break;
|
||||
}
|
||||
switch (line) {
|
||||
case "CAPA":
|
||||
write(PLUS_OK);
|
||||
write("USER");
|
||||
write(".");
|
||||
break;
|
||||
case "USER user":
|
||||
case "PASS pw":
|
||||
case "NOOP":
|
||||
write(PLUS_OK);
|
||||
break;
|
||||
case "STAT":
|
||||
write("+OK 1 3");
|
||||
break;
|
||||
case "RETR 1":
|
||||
write(PLUS_OK);
|
||||
write(MESSAGE);
|
||||
write(".");
|
||||
break;
|
||||
case "QUIT":
|
||||
write(PLUS_OK);
|
||||
socket.close();
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
if (!this.stopped) {
|
||||
LOGGER.error(IO_EXCEPTION, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ImapServer extends MailServer {
|
||||
|
||||
private volatile boolean seen;
|
||||
|
||||
private volatile boolean idled;
|
||||
|
||||
ImapServer(int port) throws IOException {
|
||||
super(port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetServer() {
|
||||
super.resetServer();
|
||||
this.seen = false;
|
||||
this.idled = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MailHandler mailHandler(Socket socket) {
|
||||
return new ImapHandler(socket);
|
||||
}
|
||||
|
||||
class ImapHandler extends MailHandler {
|
||||
|
||||
private static final String OK_FETCH_COMPLETED = "OK FETCH completed";
|
||||
|
||||
/**
|
||||
* Time to wait while IDLE before returning a result.
|
||||
*/
|
||||
private static final int IDLE_WAIT_TIME = 500;
|
||||
|
||||
ImapHandler(Socket socket) {
|
||||
super(socket);
|
||||
}
|
||||
|
||||
@Override // NOSONAR
|
||||
void doRun() {
|
||||
try {
|
||||
write("* OK IMAP4rev1 Service Ready");
|
||||
String idleTag = "";
|
||||
while (!socket.isClosed()) {
|
||||
String line = reader.readLine();
|
||||
if (line == null) {
|
||||
break;
|
||||
}
|
||||
String tag = line.substring(0, line.indexOf(' ') + 1);
|
||||
if (line.endsWith("CAPABILITY")) {
|
||||
write("* CAPABILITY IDLE IMAP4rev1");
|
||||
write(tag + "OK CAPABILITY completed");
|
||||
}
|
||||
else if (line.endsWith("LOGIN user pw")) {
|
||||
write(tag + "OK LOGIN completed");
|
||||
}
|
||||
else if (line.endsWith("LIST \"\" INBOX")) {
|
||||
write("* LIST \"/\" \"INBOX\"");
|
||||
write(tag + "OK LIST completed");
|
||||
}
|
||||
else if (line.endsWith("LIST \"\" \"\"")) {
|
||||
write("* LIST \"/\" \"\"");
|
||||
write(tag + "OK LIST completed");
|
||||
}
|
||||
else if (line.endsWith("SELECT INBOX")) {
|
||||
write("* 1 EXISTS");
|
||||
if (!seen) {
|
||||
write("* 1 RECENT");
|
||||
write("* OK [UNSEEN 1]");
|
||||
}
|
||||
else {
|
||||
write("* OK");
|
||||
}
|
||||
write("* OK [PERMANENTFLAGS (\\Deleted \\Seen \\*)]"); // \* - user flags allowed
|
||||
write(tag + "OK SELECT completed");
|
||||
}
|
||||
else if (line.endsWith("EXAMINE INBOX")) {
|
||||
write(tag + "OK");
|
||||
}
|
||||
else if (line.endsWith("SEARCH FROM bar@baz UNSEEN ALL")) {
|
||||
searchReply(tag);
|
||||
}
|
||||
else if (line.endsWith("SEARCH NOT (DELETED) NOT (SEEN) NOT (KEYWORD testSIUserFlag) ALL")) {
|
||||
searchReply(tag);
|
||||
assertions.add("searchWithUserFlag");
|
||||
}
|
||||
else if (line.contains("FETCH 1 (ENVELOPE")) {
|
||||
write("* 1 FETCH (RFC822.SIZE "
|
||||
+ MESSAGE.length()
|
||||
+ " INTERNALDATE \"27-May-2013 09:45:41 +0000\" "
|
||||
+ "FLAGS (\\Seen) "
|
||||
+ "ENVELOPE (\"Mon, 27 May 2013 15:14:49 +0530\" "
|
||||
+ "\"Test Email\" "
|
||||
+ "((\"Bar\" NIL \"bar\" \"baz\")) " // From
|
||||
+ "((\"Bar\" NIL \"bar\" \"baz\")) " // Sender
|
||||
+ "((\"Bar\" NIL \"bar\" \"baz\")) " // Reply To
|
||||
+ "((\"Foo\" NIL \"foo\" \"bar\")) " // To
|
||||
+ "((NIL NIL \"a\" \"b\") (NIL NIL \"c\" \"d\")) " // cc
|
||||
+ "((NIL NIL \"e\" \"f\") (NIL NIL \"g\" \"h\")) " // bcc
|
||||
+ "\"<4DA0A7E4.3010506@baz.net>\" " // In reply to
|
||||
+ "\"<CACVnpJkAUUfa3d_-4GNZW2WpxbB39tBCHC=T0gc7hty6dOEHcA@foo.bar.com>\") " // msgid
|
||||
+ "BODYSTRUCTURE "
|
||||
+ "(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"ISO-8859-1\") NIL NIL \"7BIT\" 1 5)))");
|
||||
write(tag + OK_FETCH_COMPLETED);
|
||||
}
|
||||
else if (line.contains("FETCH 2 (BODYSTRUCTURE)")) {
|
||||
write("* 2 FETCH " +
|
||||
"BODYSTRUCTURE "
|
||||
+ "(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"ISO-8859-1\") NIL NIL \"7BIT\" 1 5)))");
|
||||
write(tag + OK_FETCH_COMPLETED);
|
||||
}
|
||||
else if (line.contains("STORE 1 +FLAGS (\\Flagged)")) {
|
||||
write("* 1 FETCH (FLAGS (\\Flagged))");
|
||||
write(tag + "OK STORE completed");
|
||||
}
|
||||
else if (line.contains("STORE 1 +FLAGS (\\Seen)")) {
|
||||
write("* 1 FETCH (FLAGS (\\Flagged \\Seen))");
|
||||
write(tag + "OK STORE completed");
|
||||
seen = true;
|
||||
}
|
||||
else if (line.contains("FETCH 1 FLAGS")) {
|
||||
write("* 1 FLAGS(\\Seen)");
|
||||
write(tag + OK_FETCH_COMPLETED);
|
||||
}
|
||||
else if (line.contains("FETCH 1 (BODY.PEEK")) {
|
||||
write("* 1 FETCH (BODY[]<0> {" + (MESSAGE.length() + 2) + "}");
|
||||
write(MESSAGE);
|
||||
write(")");
|
||||
write(tag + OK_FETCH_COMPLETED);
|
||||
}
|
||||
else if (line.contains("CLOSE")) {
|
||||
write(tag + "OK CLOSE completed");
|
||||
}
|
||||
else if (line.contains("NOOP")) {
|
||||
write(tag + "OK NOOP completed");
|
||||
}
|
||||
else if (line.endsWith("STORE 1 +FLAGS (testSIUserFlag)")) {
|
||||
write(tag + "OK STORE completed");
|
||||
assertions.add("storeUserFlag");
|
||||
}
|
||||
else if (line.endsWith("IDLE")) {
|
||||
write("+ idling");
|
||||
idleTag = tag;
|
||||
if (!idled) {
|
||||
try {
|
||||
Thread.sleep(IDLE_WAIT_TIME);
|
||||
write("* 2 EXISTS");
|
||||
seen = false;
|
||||
}
|
||||
catch (@SuppressWarnings("unused") InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
idled = true;
|
||||
}
|
||||
else if (line.equals("DONE")) {
|
||||
write(idleTag + "OK");
|
||||
}
|
||||
else if (line.contains("LOGOUT")) {
|
||||
write(tag + "OK LOGOUT completed");
|
||||
this.socket.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
if (!this.stopped) {
|
||||
LOGGER.error(IO_EXCEPTION, e);
|
||||
}
|
||||
}
|
||||
} // NOSONAR
|
||||
|
||||
void searchReply(String tag) throws IOException {
|
||||
if (seen) {
|
||||
write("* SEARCH");
|
||||
}
|
||||
else {
|
||||
write("* SEARCH 1");
|
||||
}
|
||||
write(tag + "OK SEARCH completed");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public abstract static class MailServer implements Runnable {
|
||||
|
||||
protected final Log LOGGER = LogFactory.getLog(getClass()); // NOSONAR
|
||||
|
||||
protected static final String IO_EXCEPTION = "IOException"; // NOSONAR
|
||||
|
||||
private final ServerSocket serverSocket;
|
||||
|
||||
private final ExecutorService exec = Executors.newCachedThreadPool();
|
||||
|
||||
protected final Set<String> assertions = new HashSet<>(); // NOSONAR protected
|
||||
|
||||
protected final List<String> messages = new ArrayList<>(); // NOSONAR protected
|
||||
|
||||
private final List<MailHandler> handlers = new ArrayList<>();
|
||||
|
||||
private volatile boolean listening;
|
||||
|
||||
MailServer(int port) throws IOException {
|
||||
this.serverSocket = ServerSocketFactory.getDefault().createServerSocket(port);
|
||||
this.listening = true;
|
||||
exec.execute(this);
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return this.serverSocket.getLocalPort();
|
||||
}
|
||||
|
||||
public boolean isListening() {
|
||||
return listening;
|
||||
}
|
||||
|
||||
public List<String> getMessages() {
|
||||
return messages;
|
||||
}
|
||||
|
||||
public void resetServer() {
|
||||
this.assertions.clear();
|
||||
}
|
||||
|
||||
public boolean assertReceived(String assertion) {
|
||||
return this.assertions.contains(assertion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
while (!serverSocket.isClosed()) {
|
||||
Socket socket = this.serverSocket.accept();
|
||||
MailHandler mailHandler = mailHandler(socket);
|
||||
this.handlers.add(mailHandler);
|
||||
exec.execute(mailHandler);
|
||||
}
|
||||
}
|
||||
catch (@SuppressWarnings("unused") IOException e) {
|
||||
this.listening = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract MailHandler mailHandler(Socket socket);
|
||||
|
||||
public void stop() {
|
||||
try {
|
||||
for (MailHandler handler : this.handlers) {
|
||||
handler.stop();
|
||||
}
|
||||
this.serverSocket.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOGGER.error(IO_EXCEPTION, e);
|
||||
}
|
||||
this.exec.shutdownNow();
|
||||
}
|
||||
|
||||
public abstract class MailHandler implements Runnable {
|
||||
|
||||
public static final String BODY = "foo\r\n";
|
||||
|
||||
public static final String MESSAGE =
|
||||
"To: Foo <foo@bar>\r\n"
|
||||
+ "cc: a@b, c@d\r\n"
|
||||
+ "bcc: e@f, g@h\r\n"
|
||||
+ "From: Bar <bar@baz>, Bar2 <bar2@baz>\r\n"
|
||||
+ "Subject: Test Email\r\n"
|
||||
+ "\r\n" + BODY;
|
||||
|
||||
protected final Socket socket; // NOSONAR protected
|
||||
|
||||
private BufferedWriter writer;
|
||||
|
||||
protected StringBuilder sb = new StringBuilder(); // NOSONAR protected
|
||||
|
||||
protected BufferedReader reader; // NOSONAR protected
|
||||
|
||||
protected boolean stopped; // NOSONAR
|
||||
|
||||
MailHandler(Socket socket) {
|
||||
this.socket = socket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
this.reader = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
|
||||
this.writer = new BufferedWriter(new OutputStreamWriter(this.socket.getOutputStream()));
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOGGER.error(IO_EXCEPTION, e);
|
||||
}
|
||||
doRun();
|
||||
}
|
||||
|
||||
protected void write(String str) throws IOException {
|
||||
this.writer.write(str);
|
||||
this.writer.write("\r\n");
|
||||
this.writer.flush();
|
||||
}
|
||||
|
||||
abstract void doRun();
|
||||
|
||||
void stop() {
|
||||
this.stopped = true;
|
||||
try {
|
||||
this.socket.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
// NOSONAR
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private TestMailServer() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -114,22 +114,6 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify whether the URI should be encoded after any <code>uriVariables</code>
|
||||
* are expanded and before sending the request. The default value is <code>true</code>.
|
||||
* @param encodeUri true if the URI should be encoded.
|
||||
* @since 4.1
|
||||
* @deprecated since 5.3 in favor of {@link #setEncodingMode}
|
||||
* @see org.springframework.web.util.UriComponentsBuilder
|
||||
*/
|
||||
@Deprecated
|
||||
public void setEncodeUri(boolean encodeUri) {
|
||||
setEncodingMode(
|
||||
encodeUri
|
||||
? DefaultUriBuilderFactory.EncodingMode.TEMPLATE_AND_VALUES
|
||||
: DefaultUriBuilderFactory.EncodingMode.NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the encoding mode to use.
|
||||
* By default, this is set to {@link DefaultUriBuilderFactory.EncodingMode#TEMPLATE_AND_VALUES}.
|
||||
@@ -181,16 +165,6 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro
|
||||
this.webServiceTemplate.setFaultMessageResolver(faultMessageResolver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the {@link WebServiceMessageSender} to use.
|
||||
* @param messageSender the sender.
|
||||
* @deprecated in favor of {@link #setMessageSenders(WebServiceMessageSender...)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setMessageSender(WebServiceMessageSender messageSender) {
|
||||
setMessageSenders(messageSender);
|
||||
}
|
||||
|
||||
public void setMessageSenders(WebServiceMessageSender... messageSenders) {
|
||||
Assert.state(!this.webServiceTemplateExplicitlySet,
|
||||
() -> "'messageSenders' must be specified on the provided: " + this.webServiceTemplate);
|
||||
@@ -205,7 +179,7 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro
|
||||
|
||||
@Override
|
||||
protected void doInit() {
|
||||
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory());
|
||||
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
|
||||
Assert.state(this.destinationProvider == null || CollectionUtils.isEmpty(this.uriVariableExpressions),
|
||||
"uri variables are not supported when a DestinationProvider is supplied.");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-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.
|
||||
@@ -86,7 +86,6 @@ public class WebServiceOutboundGatewayParser extends AbstractOutboundGatewayPars
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reply-timeout", "sendTimeout");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "requires-reply");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "ignore-empty-responses");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "encode-uri");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "encoding-mode");
|
||||
postProcessGateway(builder, element, parserContext);
|
||||
|
||||
@@ -122,9 +121,6 @@ public class WebServiceOutboundGatewayParser extends AbstractOutboundGatewayPars
|
||||
parserContext.getReaderContext().error(
|
||||
"Only one of message-sender or message-senders should be specified.", element);
|
||||
}
|
||||
if (StringUtils.hasText(messageSenderRef)) {
|
||||
builder.addPropertyReference("messageSender", messageSenderRef);
|
||||
}
|
||||
if (StringUtils.hasText(messageSenderListRef)) {
|
||||
builder.addPropertyReference("messageSenders", messageSenderListRef);
|
||||
}
|
||||
|
||||
@@ -124,19 +124,6 @@
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="encode-uri" default="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
[DEPRECATED] When set to "false", the URI won't be encoded before the request is sent. This may be useful
|
||||
in some scenarios as it allows user control over the encoding, if needed. Default is "true".
|
||||
This attribute is ignored, if 'destination-provider' is specified.
|
||||
Deprecated since 5.3 in favor of 'encoding-mode'.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:union memberTypes="xsd:boolean xsd:string"/>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="encoding-mode" default="TEMPLATE_AND_VALUES">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
@@ -240,18 +227,6 @@
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="message-sender" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Reference to the bean definition of a WebServiceMessageSender.
|
||||
</xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="org.springframework.ws.transport.WebServiceMessageSender"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="message-senders" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<si:chain input-channel="wsOutboundGatewayInsideChain" output-channel="replyChannel">
|
||||
<ws:outbound-gateway uri="http://test.example.org"
|
||||
message-sender="mockMessageSender"/>
|
||||
message-senders="mockMessageSender"/>
|
||||
</si:chain>
|
||||
|
||||
<bean id="mockMessageSender" class="org.springframework.integration.ws.SimpleWebServiceOutboundGatewayTests"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<ws:outbound-gateway request-channel="inputJms"
|
||||
uri="jms:{destination}?deliveryMode={deliveryMode}&priority={priority}"
|
||||
interceptor="interceptor"
|
||||
message-sender="jmsMessageSender">
|
||||
message-senders="jmsMessageSender">
|
||||
<ws:uri-variable name="destination" expression="headers.jmsQueue"/>
|
||||
<ws:uri-variable name="deliveryMode" expression="headers.deliveryMode"/>
|
||||
<ws:uri-variable name="priority" expression="headers.jms_priority"/>
|
||||
@@ -44,7 +44,7 @@
|
||||
uri="mailto:{to}?subject={subject}"
|
||||
encoding-mode="VALUES_ONLY"
|
||||
interceptor="emailInterceptor"
|
||||
message-sender="emailMessageSender">
|
||||
message-senders="emailMessageSender">
|
||||
<ws:uri-variable name="to" expression="headers.to"/>
|
||||
<ws:uri-variable name="subject" expression="headers.subject"/>
|
||||
</ws:outbound-gateway>
|
||||
@@ -61,7 +61,7 @@
|
||||
<ws:outbound-gateway request-channel="inputXmpp"
|
||||
uri="xmpp:{user}@jabber.org"
|
||||
interceptor="interceptor"
|
||||
message-sender="xmppMessageSender">
|
||||
message-senders="xmppMessageSender">
|
||||
<ws:uri-variable name="user" expression="headers.to"/>
|
||||
</ws:outbound-gateway>
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<ws:outbound-gateway id="gatewayWithCustomMessageSender"
|
||||
request-channel="inputChannel"
|
||||
uri="https://example.org"
|
||||
message-sender="messageSender"/>
|
||||
message-senders="messageSender"/>
|
||||
|
||||
<ws:outbound-gateway id="gatewayWithCustomMessageSenderList"
|
||||
request-channel="inputChannel"
|
||||
|
||||
@@ -149,8 +149,7 @@ What if we wish to take some action depending on the result of the `receive` par
|
||||
===== "`Smart`" Polling
|
||||
|
||||
Version 5.3 introduced the `ReceiveMessageAdvice` interface.
|
||||
(The `AbstractMessageSourceAdvice` has been deprecated in favor of `default` methods in the `MessageSourceMutator`.)
|
||||
Any `Advice` objects in the `advice-chain` that implement this interface are applied only to the receive operation - `MessageSource.receive()` and `PollableChannel.receive(timeout)`.
|
||||
Any `Advice` objects in the `advice-chain` that implement this interface are applied only to the `receive()` operation - `MessageSource.receive()` and `PollableChannel.receive(timeout)`.
|
||||
Therefore, they can be applied only for the `SourcePollingChannelAdapter` or `PollingConsumer`.
|
||||
Such classes implement the following methods:
|
||||
|
||||
@@ -185,9 +184,8 @@ If you wish to change the order, you must wire up the proxy yourself.
|
||||
|
||||
===== `SimpleActiveIdleReceiveMessageAdvice`
|
||||
|
||||
(The previous `SimpleActiveIdleMessageSourceAdvice` for only `MessageSource` is deprecated.)
|
||||
This advice is a simple implementation of `ReceiveMessageAdvice`.
|
||||
When used in conjunction with a `DynamicPeriodicTrigger`, it adjusts the polling frequency, depending on whether or not the previous poll resulted in a message or not.
|
||||
When used in conjunction with a `DynamicPeriodicTrigger`, it adjusts the polling frequency, depending on whether the previous poll resulted in a message or not.
|
||||
The poller must also have a reference to the same `DynamicPeriodicTrigger`.
|
||||
|
||||
.Important: Async Handoff
|
||||
@@ -250,5 +248,4 @@ To use this advice where you wish to use async operations after the result of a
|
||||
|
||||
Some advices might be applied only for the `MessageSource.receive()` and they don't make sense for `PollableChannel`.
|
||||
For this purpose a `MessageSourceMutator` interface (an extension of the `ReceiveMessageAdvice`) is still present.
|
||||
With `default` methods it fully replaces already deprecated `AbstractMessageSourceAdvice` and should be used in those implementations where only `MessageSource` proxying is expected.
|
||||
See <<./ftp.adoc#ftp-rotating-server-advice,Inbound Channel Adapters: Polling Multiple Servers and Directories>> for more information.
|
||||
|
||||
Reference in New Issue
Block a user