Class MessageTransformingHandler
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.transformer.MessageTransformingHandler
- All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>,Aware,BeanClassLoaderAware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,ApplicationContextAware,Lifecycle,Ordered,ExpressionCapable,Orderable,MessageProducer,HeaderPropagationAware,IntegrationPattern,NamedComponent,IntegrationManagement,ManageableLifecycle,TrackableComponent,MessageHandler,reactor.core.CoreSubscriber<Message<?>>
public class MessageTransformingHandler
extends AbstractReplyProducingMessageHandler
implements ManageableLifecycle
A reply-producing
MessageHandler
that delegates to a Transformer instance to modify the received Message
and sends the result to its output channel.- Author:
- Mark Fisher, Oleg Zhurakousky, Artem Bilan, Gary Russell
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
AbstractReplyProducingMessageHandler.RequestHandlerNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
messagingTemplateFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionCreate aMessageTransformingHandlerinstance.MessageTransformingHandler(Transformer transformer) Create aMessageTransformingHandlerinstance that delegates to the providedTransformer. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNotPropagatedHeaders(String... headers) Add header patterns ("xxx*", "*xxx", "*xxx*" or "xxx*yyy") that will NOT be copied from the inbound message ifAbstractMessageProducingHandler.shouldCopyRequestHeaders()is true, instead of overwriting the existing set.protected voiddoInit()Subclasses may implement this method to provide component type information.Return a pattern type this component implements.protected ObjecthandleRequestMessage(Message<?> message) Subclasses must implement this method to handle the request Message.booleanvoidsetTransformer(Transformer transformer) Provide aTransformerdelegate.protected booleanSubclasses may override this.voidstart()voidstop()Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
doInvokeAdvisedRequestHandler, getBeanClassLoader, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReplyMethods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandler
createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, setupMessageProcessor, shouldSplitOutput, updateNotPropagatedHeadersMethods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface reactor.core.CoreSubscriber
currentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Constructor Details
-
MessageTransformingHandler
public MessageTransformingHandler()Create aMessageTransformingHandlerinstance. The target delegateTransformermust be provided then via setter.- Since:
- 6.2
-
MessageTransformingHandler
Create aMessageTransformingHandlerinstance that delegates to the providedTransformer.- Parameters:
transformer- The transformer.
-
-
Method Details
-
setTransformer
Provide aTransformerdelegate.- Parameters:
transformer- theTransformerto use.- Since:
- 6.2
-
getComponentType
Description copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
getComponentTypein interfaceNamedComponent- Overrides:
getComponentTypein classMessageHandlerSupport
-
getIntegrationPatternType
Description copied from interface:IntegrationPatternReturn a pattern type this component implements.- Specified by:
getIntegrationPatternTypein interfaceIntegrationPattern- Overrides:
getIntegrationPatternTypein classAbstractReplyProducingMessageHandler- Returns:
- the
IntegrationPatternTypethis component implements.
-
addNotPropagatedHeaders
Description copied from class:AbstractMessageProducingHandlerAdd header patterns ("xxx*", "*xxx", "*xxx*" or "xxx*yyy") that will NOT be copied from the inbound message ifAbstractMessageProducingHandler.shouldCopyRequestHeaders()is true, instead of overwriting the existing set.- Specified by:
addNotPropagatedHeadersin interfaceHeaderPropagationAware- Overrides:
addNotPropagatedHeadersin classAbstractMessageProducingHandler- Parameters:
headers- the headers to not propagate from the inbound message.- See Also:
-
doInit
protected void doInit()- Overrides:
doInitin classAbstractReplyProducingMessageHandler
-
start
public void start()- Specified by:
startin interfaceLifecycle- Specified by:
startin interfaceManageableLifecycle
-
stop
public void stop()- Specified by:
stopin interfaceLifecycle- Specified by:
stopin interfaceManageableLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceLifecycle- Specified by:
isRunningin interfaceManageableLifecycle
-
handleRequestMessage
Description copied from class:AbstractReplyProducingMessageHandlerSubclasses must implement this method to handle the request Message. The return value may be a Message, a MessageBuilder, or any plain Object. The base class will handle the final creation of a reply Message from any of those starting points. If the return value is null, the Message flow will end here.- Specified by:
handleRequestMessagein classAbstractReplyProducingMessageHandler- Parameters:
message- The request message.- Returns:
- The result of handling the message, or
null.
-
shouldCopyRequestHeaders
protected boolean shouldCopyRequestHeaders()Description copied from class:AbstractMessageProducingHandlerSubclasses may override this. True by default.- Overrides:
shouldCopyRequestHeadersin classAbstractMessageProducingHandler- Returns:
- true if the request headers should be copied.
-