public class HeaderEnricherSpec extends ConsumerEndpointSpec<HeaderEnricherSpec,MessageTransformingHandler>
IntegrationComponentSpec
for a HeaderEnricher
.adviceChain
componentsToRegister, endpointFactoryBean, handler
logger, PARSER, target
Modifier and Type | Method and Description |
---|---|
HeaderEnricherSpec |
defaultOverwrite(boolean defaultOverwrite)
Determine the default action to take when setting individual header specifications
without an explicit 'overwrite' argument.
|
protected reactor.util.function.Tuple2<ConsumerEndpointFactoryBean,MessageTransformingHandler> |
doGet() |
<V> HeaderEnricherSpec |
header(java.lang.String headerName,
HeaderValueMessageProcessor<V> headerValueMessageProcessor)
Add a single header specification where the value is obtained by calling the
HeaderValueMessageProcessor . |
<V> HeaderEnricherSpec |
header(java.lang.String name,
V value)
Add a single header specification.
|
<V> HeaderEnricherSpec |
header(java.lang.String name,
V value,
java.lang.Boolean overwrite)
Add a single header specification.
|
HeaderEnricherSpec |
headerChannelsToString()
Add header specifications to automatically convert header channels (reply, error
channels) to Strings and store them in a header channel registry.
|
HeaderEnricherSpec |
headerChannelsToString(java.lang.String timeToLiveExpression)
Add header specifications to automatically convert header channels (reply, error
channels) to Strings and store them in a header channel registry.
|
HeaderEnricherSpec |
headerExpression(java.lang.String name,
java.lang.String expression)
Add a single header specification where the value is a String representation of a
SpEL
Expression . |
HeaderEnricherSpec |
headerExpression(java.lang.String name,
java.lang.String expression,
java.lang.Boolean overwrite)
Add a single header specification where the value is a String representation of a
SpEL
Expression . |
HeaderEnricherSpec |
headerExpressions(java.util.function.Consumer<StringStringMapBuilder> configurer)
Add header specifications via the consumer callback, which receives a
StringStringMapBuilder ; the Map values must be String
representations of SpEL expressions that will be evaluated at run time when the
message headers are enriched. |
HeaderEnricherSpec |
headerExpressions(java.util.function.Consumer<StringStringMapBuilder> configurer,
java.lang.Boolean overwrite)
Add header specifications via the consumer callback, which receives a
StringStringMapBuilder ; the Map values must be String
representations of SpEL expressions that will be evaluated at run time when the
message headers are enriched. |
HeaderEnricherSpec |
headerExpressions(java.util.Map<java.lang.String,java.lang.String> headers)
Add header specifications; the
Map values must be String representations
of SpEL expressions that will be evaluated at run time when the message headers are
enriched. |
HeaderEnricherSpec |
headerExpressions(java.util.Map<java.lang.String,java.lang.String> headers,
java.lang.Boolean overwrite)
Add header specifications; the
Map values must be String representations of
SpEL expressions that will be evaluated at run time when the message headers are
enriched. |
HeaderEnricherSpec |
headerExpressions(MapBuilder<?,java.lang.String,java.lang.String> headers)
Add header specifications from the
MapBuilder ; the Map values must
be String representations of SpEL expressions that will be evaluated at run time
when the message headers are enriched. |
HeaderEnricherSpec |
headerExpressions(MapBuilder<?,java.lang.String,java.lang.String> headers,
java.lang.Boolean overwrite)
Add header specifications from the
MapBuilder ; the Map values must
be String representations of SpEL expressions that will be evaluated at run time
when the message headers are enriched. |
<P> HeaderEnricherSpec |
headerFunction(java.lang.String name,
java.util.function.Function<org.springframework.messaging.Message<P>,java.lang.Object> function)
Add a single header specification where the value is obtained by invoking the
Function callback. |
<P> HeaderEnricherSpec |
headerFunction(java.lang.String name,
java.util.function.Function<org.springframework.messaging.Message<P>,java.lang.Object> function,
java.lang.Boolean overwrite)
Add a single header specification where the value is obtained by invoking the
Function callback. |
HeaderEnricherSpec |
headers(java.util.Map<java.lang.String,java.lang.Object> headers)
Add header specifications from the
Map ; if a map value is an
Expression , it will be evaluated at run time when the message headers are
enriched. |
HeaderEnricherSpec |
headers(java.util.Map<java.lang.String,java.lang.Object> headers,
java.lang.Boolean overwrite)
Add header specifications from the
Map ; if a map value is an
Expression , it will be evaluated at run time when the message headers are
enriched. |
HeaderEnricherSpec |
headers(MapBuilder<?,java.lang.String,java.lang.Object> headers)
Add header specifications from the
MapBuilder ; if a map value is an
Expression , it will be evaluated at run time when the message headers are
enriched. |
HeaderEnricherSpec |
headers(MapBuilder<?,java.lang.String,java.lang.Object> headers,
java.lang.Boolean overwrite)
Add header specifications from the
MapBuilder ; if a map value is an
Expression , it will be evaluated at run time when the message headers are
enriched. |
HeaderEnricherSpec |
messageProcessor(MessageProcessor<?> messageProcessor)
Configure an optional custom
MessageProcessor for the enricher. |
HeaderEnricherSpec |
messageProcessor(java.lang.String expression)
Configure an
ExpressionEvaluatingMessageProcessor that evaluates to a
Map of additional headers. |
HeaderEnricherSpec |
messageProcessor(java.lang.String beanName,
java.lang.String methodName)
Configure an
MethodInvokingMessageProcessor that
invokes the method on the bean - the method must return a Map of headers. |
HeaderEnricherSpec |
shouldSkipNulls(boolean shouldSkipNulls) |
advice, async, autoStartup, notPropagatedHeaders, order, phase, poller, requiresReply, role, sendTimeout, taskScheduler, transactional, transactional, transactional, transactional, transactional
assertHandler, getComponentsToRegister, id, obtainInputChannelFromFlow, obtainInputChannelFromFlow, poller, poller
_this, afterPropertiesSet, destroy, get, getId, getObject, getObjectType, isSingleton
public HeaderEnricherSpec defaultOverwrite(boolean defaultOverwrite)
defaultOverwrite
- the defaultOverwrite.HeaderEnricher.setDefaultOverwrite(boolean)
public HeaderEnricherSpec shouldSkipNulls(boolean shouldSkipNulls)
shouldSkipNulls
- the shouldSkipNulls.HeaderEnricher.setShouldSkipNulls(boolean)
public HeaderEnricherSpec messageProcessor(MessageProcessor<?> messageProcessor)
MessageProcessor
for the enricher. The
processor must return a Map
of header names and values. They will be added
to the inbound message headers before evaluating the individual configured header
specifications.messageProcessor
- the messageProcessor.HeaderEnricher.setMessageProcessor(MessageProcessor)
public HeaderEnricherSpec messageProcessor(java.lang.String expression)
ExpressionEvaluatingMessageProcessor
that evaluates to a
Map
of additional headers. They will be added to the inbound message
headers before evaluating the individual configured header specifications.expression
- the expression.messageProcessor(MessageProcessor)
public HeaderEnricherSpec messageProcessor(java.lang.String beanName, java.lang.String methodName)
MethodInvokingMessageProcessor
that
invokes the method on the bean - the method must return a Map
of headers.
They will be added to the inbound message headers before evaluating the individual
configured header specifications.beanName
- The bean name.methodName
- The method name.messageProcessor(MessageProcessor)
public HeaderEnricherSpec headers(MapBuilder<?,java.lang.String,java.lang.Object> headers)
MapBuilder
; if a map value is an
Expression
, it will be evaluated at run time when the message headers are
enriched. Otherwise the value is simply added to the headers. Headers derived from
the map will not overwrite existing headers, unless
defaultOverwrite(boolean)
is true.headers
- the header map builder.public HeaderEnricherSpec headers(MapBuilder<?,java.lang.String,java.lang.Object> headers, java.lang.Boolean overwrite)
MapBuilder
; if a map value is an
Expression
, it will be evaluated at run time when the message headers are
enriched. Otherwise the value is simply added to the headers.headers
- the header map builder.overwrite
- true to overwrite existing headers.public HeaderEnricherSpec headers(java.util.Map<java.lang.String,java.lang.Object> headers)
Map
; if a map value is an
Expression
, it will be evaluated at run time when the message headers are
enriched. Otherwise the value is simply added to the headers. Headers derived from
the map will not overwrite existing headers, unless
defaultOverwrite(boolean)
is true.headers
- The header builder.public HeaderEnricherSpec headers(java.util.Map<java.lang.String,java.lang.Object> headers, java.lang.Boolean overwrite)
Map
; if a map value is an
Expression
, it will be evaluated at run time when the message headers are
enriched. Otherwise the value is simply added to the headers.headers
- The header builder.overwrite
- true to overwrite existing headers.public HeaderEnricherSpec headerExpressions(MapBuilder<?,java.lang.String,java.lang.String> headers)
MapBuilder
; the Map
values must
be String representations of SpEL expressions that will be evaluated at run time
when the message headers are enriched. Headers derived from the map will not
overwrite existing headers, unless defaultOverwrite(boolean)
is true.headers
- the header map builder.public HeaderEnricherSpec headerExpressions(MapBuilder<?,java.lang.String,java.lang.String> headers, java.lang.Boolean overwrite)
MapBuilder
; the Map
values must
be String representations of SpEL expressions that will be evaluated at run time
when the message headers are enriched.headers
- the header map builder.overwrite
- true to overwrite existing headers.public HeaderEnricherSpec headerExpressions(java.util.function.Consumer<StringStringMapBuilder> configurer)
StringStringMapBuilder
; the Map
values must be String
representations of SpEL expressions that will be evaluated at run time when the
message headers are enriched. Headers derived from the map will not
overwrite existing headers, unless defaultOverwrite(boolean)
is true.
Usually used with a JDK8 lambda:
.enrichHeaders(s -> s.headerExpressions(c -> c
.put(MailHeaders.SUBJECT, "payload.subject")
.put(MailHeaders.FROM, "payload.from[0].toString()")))
configurer
- the configurer.public HeaderEnricherSpec headerExpressions(java.util.function.Consumer<StringStringMapBuilder> configurer, java.lang.Boolean overwrite)
StringStringMapBuilder
; the Map
values must be String
representations of SpEL expressions that will be evaluated at run time when the
message headers are enriched. Usually used with a JDK8 lambda:
.enrichHeaders(s -> s.headerExpressions(c -> c
.put(MailHeaders.SUBJECT, "payload.subject")
.put(MailHeaders.FROM, "payload.from[0].toString()"), true))
configurer
- the configurer.overwrite
- true to overwrite existing headers.public HeaderEnricherSpec headerExpressions(java.util.Map<java.lang.String,java.lang.String> headers)
Map
values must be String representations
of SpEL expressions that will be evaluated at run time when the message headers are
enriched. Headers derived from the map will not overwrite existing headers,
unless defaultOverwrite(boolean)
is true.headers
- the headers.public HeaderEnricherSpec headerExpressions(java.util.Map<java.lang.String,java.lang.String> headers, java.lang.Boolean overwrite)
Map
values must be String representations of
SpEL expressions that will be evaluated at run time when the message headers are
enriched.headers
- the headers.overwrite
- true to overwrite existing headers.public <V> HeaderEnricherSpec header(java.lang.String name, V value)
defaultOverwrite(boolean)
is true.V
- the value type.name
- the header name.value
- the header value (not an Expression
).public <V> HeaderEnricherSpec header(java.lang.String name, V value, java.lang.Boolean overwrite)
V
- the value type.name
- the header name.value
- the header value (not an Expression
).overwrite
- true to overwrite an existing header.public HeaderEnricherSpec headerExpression(java.lang.String name, java.lang.String expression)
Expression
. If the header exists, it will not be overwritten
unless defaultOverwrite(boolean)
is true.name
- the header name.expression
- the expression.public HeaderEnricherSpec headerExpression(java.lang.String name, java.lang.String expression, java.lang.Boolean overwrite)
Expression
.name
- the header name.expression
- the expression.overwrite
- true to overwrite an existing header.public <P> HeaderEnricherSpec headerFunction(java.lang.String name, java.util.function.Function<org.springframework.messaging.Message<P>,java.lang.Object> function)
Function
callback. If the header exists, it will not be overwritten
unless defaultOverwrite(boolean)
is true.P
- the payload type.name
- the header name.function
- the function.FunctionExpression
public <P> HeaderEnricherSpec headerFunction(java.lang.String name, java.util.function.Function<org.springframework.messaging.Message<P>,java.lang.Object> function, java.lang.Boolean overwrite)
Function
callback.P
- the payload type.name
- the header name.function
- the function.overwrite
- true to overwrite an existing header.FunctionExpression
public <V> HeaderEnricherSpec header(java.lang.String headerName, HeaderValueMessageProcessor<V> headerValueMessageProcessor)
HeaderValueMessageProcessor
.V
- the value type.headerName
- the header name.headerValueMessageProcessor
- the message processor.public HeaderEnricherSpec headerChannelsToString()
HeaderChannelRegistry
public HeaderEnricherSpec headerChannelsToString(java.lang.String timeToLiveExpression)
timeToLiveExpression
- the minimum time that the mapping will remain in the registry.HeaderChannelRegistry
protected reactor.util.function.Tuple2<ConsumerEndpointFactoryBean,MessageTransformingHandler> doGet()
doGet
in class ConsumerEndpointSpec<HeaderEnricherSpec,MessageTransformingHandler>