public class DefaultSenderHeadersInterceptor
extends java.lang.Object
message interceptor
that is able to add some commonly required header attributes in
Synapse services.
The DefaultSenderHeadersInterceptor
is active by default for all
sender endpoints
. It can be disabled by
* setting 'synapse.sender.default-headers.enabled=false'.
The property spring.application.name
is used to determine the value of the
DefaultHeaderAttr.MSG_SENDER
header attribute. This attribute can be used to identify the
origin of a message.
Modifier and Type | Class and Description |
---|---|
static class |
DefaultSenderHeadersInterceptor.Capability
Capabilities of the DefaultSenderHeadersInterceptor.
|
Constructor and Description |
---|
DefaultSenderHeadersInterceptor(SynapseProperties synapseProperties)
Creates a new DefaultSenderHeadersInterceptor with default configuration.
|
DefaultSenderHeadersInterceptor(SynapseProperties synapseProperties,
java.util.Set<DefaultSenderHeadersInterceptor.Capability> capabilities,
java.time.Clock clock)
Creates an instance of DefaultSenderHeadersInterceptor with enhanced configuration options.
|
Modifier and Type | Method and Description |
---|---|
TextMessage |
addDefaultHeaders(TextMessage message) |
public DefaultSenderHeadersInterceptor(SynapseProperties synapseProperties)
By default, all capabilites
are enabled.
synapseProperties
- the properties used to configure the interceptorpublic DefaultSenderHeadersInterceptor(SynapseProperties synapseProperties, java.util.Set<DefaultSenderHeadersInterceptor.Capability> capabilities, java.time.Clock clock)
synapseProperties
- the properties used to configure the interceptorcapabilities
- the enabled capabilitiesclock
- the clock used to generate timestamp attributes@Nullable @MessageInterceptor(endpointType=SENDER) public TextMessage addDefaultHeaders(@Nonnull TextMessage message)