@Target(value={METHOD,ANNOTATION_TYPE})
@Retention(value=RUNTIME)
@Inherited
@Documented
public @interface Router
A method annotated with @Router may accept a parameter of type
Message
or of the expected
Message payload's type. Any type conversion supported by
SimpleTypeConverter
will be applied to
the Message payload if necessary. Header values can also be passed as
Message parameters by using the
@Header
parameter annotation.
Return values from the annotated method may be either a Collection or Array
whose elements are either
channels
or
Strings. In the latter case, the endpoint hosting this router will attempt
to resolve each channel name with the Channel Registry or with
channelMappings()
, if provided.
Modifier and Type | Optional Element and Description |
---|---|
java.lang.String |
applySequence
Specify whether sequence number and size headers should be added to each
Message.
|
java.lang.String |
autoStartup
The
SmartLifecycle autoStartup option. |
java.lang.String[] |
channelMappings
The 'key=value' pairs to represent channelMapping entries
|
java.lang.String |
defaultOutputChannel
Specify the channel to which this router will send messages for which destination
channels are not resolved and
resolutionRequired() is false. |
java.lang.String |
ignoreSendFailures
If set to
true , failures to send to a message channel will
be ignored. |
java.lang.String |
inputChannel
Specify the channel from which this router will consume messages.
|
java.lang.String |
phase
Specify a
SmartLifecycle phase option. |
Poller[] |
poller |
java.lang.String |
prefix
Specify a prefix to be added to each channel name prior to resolution.
|
java.lang.String |
resolutionRequired
Specify whether channel names must always be successfully resolved
to existing channel instances.
|
java.lang.String |
sendTimeout
Specify the maximum amount of time in milliseconds to wait when sending a reply
Message to the outputChannel . |
java.lang.String |
suffix
Specify a suffix to be added to each channel name prior to resolution.
|
public abstract java.lang.String inputChannel
DirectChannel
with this name will be
registered in the application context.public abstract java.lang.String defaultOutputChannel
resolutionRequired()
is false.public abstract java.lang.String[] channelMappings
AbstractMappingMessageRouter.setChannelMapping(String, String)
public abstract java.lang.String prefix
public abstract java.lang.String suffix
public abstract java.lang.String resolutionRequired
If set to true
(default), a MessagingException
will be raised in case the channel cannot be resolved. Setting this attribute to false
,
will cause any unresolvable channels to be ignored.
Can be specified as 'property placeholder', e.g. ${spring.integration.resolutionRequired}
.
public abstract java.lang.String applySequence
false
.
Can be specified as 'property placeholder', e.g. ${spring.integration.applySequence}
.public abstract java.lang.String ignoreSendFailures
true
, failures to send to a message channel will
be ignored. If set to false
(default), a MessageDeliveryException
will be thrown instead, and if the router resolves more than one channel,
any subsequent channels will not receive the message.
Please be aware that when using direct channels (single threaded),
send-failures can be caused by exceptions thrown by components
much further down-stream.
Can be specified as 'property placeholder', e.g. ${spring.integration.ignoreSendFailures}
.public abstract java.lang.String sendTimeout
Message
to the outputChannel
.
Defaults to -1
- blocking indefinitely.
It is applied only if the output channel has some 'sending' limitations, e.g.
QueueChannel
with
fixed a 'capacity'. In this case a MessageDeliveryException
is thrown.
The 'sendTimeout' is ignored in case of
AbstractSubscribableChannel
implementations.
Can be specified as 'property placeholder', e.g. ${spring.integration.sendTimeout}
.public abstract java.lang.String autoStartup
SmartLifecycle
autoStartup
option.
Can be specified as 'property placeholder', e.g. ${foo.autoStartup}
.
Defaults to true
.boolean
flag.public abstract java.lang.String phase
SmartLifecycle
phase
option.
Defaults 0
for PollingConsumer
and Integer.MIN_VALUE
for EventDrivenConsumer
.
Can be specified as 'property placeholder', e.g. ${foo.phase}
.SmartLifecycle
phase.public abstract Poller[] poller
Poller
options for a polled endpoint
(PollerMetadata
).
This attribute is an array
just to allow an empty default (no poller).
Only one Poller
element is allowed.