@Target(value=TYPE) @Retention(value=RUNTIME) @Documented public @interface MessagingGateway
<gateway/>
) as an abstraction over the messaging API. The target
application's business logic may be completely unaware of the Spring Integration
API, with the code interacting only via the interface.
Important: The IntegrationComponentScan
annotation is required along with
Configuration
to scan interfaces annotated with MessagingGateway
, because the
standard ComponentScan
ignores interfaces.
IntegrationComponentScan
Modifier and Type | Optional Element and Description |
---|---|
String |
asyncExecutor
|
GatewayHeader[] |
defaultHeaders
Provides custom message headers.
|
String |
defaultPayloadExpression
An expression that will be used to generate the
payload for all methods in the service interface
unless explicitly overridden by a method declaration. |
String |
defaultReplyChannel
Identifies the default channel the gateway proxy will subscribe to, to receive reply
Message s, the payloads of
which will be converted to the return type of the method signature. |
String |
defaultReplyTimeout
Allows to specify how long this gateway will wait for the reply
Message
before returning. |
String |
defaultRequestChannel
Identifies the default channel to which messages will be sent upon invocation
of methods of the gateway proxy.
|
String |
defaultRequestTimeout
Provides the amount of time dispatcher would wait to send a
Message . |
String |
errorChannel
Identifies a channel that error messages will be sent to if a failure occurs in the
gateway's proxy invocation.
|
String |
mapper
An
MethodArgsMessageMapper
to map the method arguments to a Message . |
String |
name
The value may indicate a suggestion for a logical component name,
to be turned into a Spring bean in case of an autodetected component.
|
boolean |
proxyDefaultMethods
Indicate if
default methods on the interface should be proxied as well. |
public abstract String name
public abstract String defaultRequestChannel
public abstract String defaultReplyChannel
Message
s, the payloads of
which will be converted to the return type of the method signature.public abstract String errorChannel
errorChannel
reference is provided, the gateway will
propagate Exception
s to the caller. To completely suppress Exception
s, provide a
reference to the nullChannel
here.public abstract String defaultRequestTimeout
Message
. This
timeout would only apply if there is a potential to block in the send call. For
example if this gateway is hooked up to a QueueChannel
. Value is specified
in milliseconds; it can be a simple long value or a SpEL expression; array variable
#args is available.public abstract String defaultReplyTimeout
Message
before returning. By default it will wait indefinitely. null
is returned if
the gateway times out. Value is specified in milliseconds; it can be a simple long
value or a SpEL expression; array variable #args is available.public abstract String asyncExecutor
Executor
to use for any of the interface methods that have a Future
return type.
This Executor
will only be used for those async methods; the sync methods
will be invoked in the caller's thread.
Use AnnotationConstants.NULL
to specify no async executor - for example
if your downstream flow returns a Future
.public abstract String defaultPayloadExpression
payload
for all methods in the service interface
unless explicitly overridden by a method declaration. Variables include #args
, #methodName
,
#methodString
and #methodObject
;
a bean resolver is also available, enabling expressions like @someBean(#args)
.public abstract GatewayHeader[] defaultHeaders
public abstract String mapper
MethodArgsMessageMapper
to map the method arguments to a Message
. When this
is provided, no payload-expression
s or header
s are allowed; the custom mapper is
responsible for creating the message.public abstract boolean proxyDefaultMethods
default
methods on the interface should be proxied as well.
If an explicit Gateway
annotation is present on method it is proxied
independently of this option.
Note: default methods in JDK classes (such as Function
) can be proxied, but cannot be invoked
via MethodHandle
by an internal Java security restriction for MethodHandle.Lookup
.MethodHandle
.