Class DelegatingMessageGroupProcessor
java.lang.Object
org.springframework.integration.aggregator.DelegatingMessageGroupProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.context.Lifecycle
,MessageGroupProcessor
,ManageableLifecycle
public class DelegatingMessageGroupProcessor extends java.lang.Object implements MessageGroupProcessor, org.springframework.beans.factory.BeanFactoryAware, ManageableLifecycle
The
MessageGroupProcessor
implementation with delegation to the provided delegate
and optional aggregation for headers.
Unlike AbstractAggregatingMessageGroupProcessor
this processor checks a result
of the delegate
call and aggregates headers into the output only
if the result is not a Message
or AbstractIntegrationMessageBuilder
.
This processor is used internally for wrapping provided non-standard MessageGroupProcessor
when a aggregate headers Function
is provided.
For POJO method invoking or SpEL expression evaluation it is recommended to use an
AbstractAggregatingMessageGroupProcessor
implementations.
- Since:
- 5.2
-
Constructor Summary
Constructors Constructor Description DelegatingMessageGroupProcessor(MessageGroupProcessor delegate, java.util.function.Function<MessageGroup,java.util.Map<java.lang.String,java.lang.Object>> headersFunction)
-
Method Summary
Modifier and Type Method Description boolean
isRunning()
java.lang.Object
processMessageGroup(MessageGroup group)
Process the given MessageGroup.void
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
void
start()
void
stop()
-
Constructor Details
-
DelegatingMessageGroupProcessor
public DelegatingMessageGroupProcessor(MessageGroupProcessor delegate, java.util.function.Function<MessageGroup,java.util.Map<java.lang.String,java.lang.Object>> headersFunction)
-
-
Method Details
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException- Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Throws:
org.springframework.beans.BeansException
-
processMessageGroup
Description copied from interface:MessageGroupProcessor
Process the given MessageGroup. Implementations are free to return as few or as many messages based on the invocation as needed. For example an aggregating processor will return only a single message representing the group, while a resequencing processor will return all messages whose preceding sequence has been satisfied.If a multiple messages are returned the return value must be a Collection<Message>.
- Specified by:
processMessageGroup
in interfaceMessageGroupProcessor
- Parameters:
group
- The message group.- Returns:
- The result of processing the group.
-
start
public void start()- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
- Specified by:
start
in interfaceManageableLifecycle
-
stop
public void stop()- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
- Specified by:
stop
in interfaceManageableLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
- Specified by:
isRunning
in interfaceManageableLifecycle
-