Annotation Interface MessagingGateway
A stereotype annotation to provide an Integration Messaging Gateway Proxy
 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.
 
 The Gateway annotation can be used for the per interface method configuration.
- Since:
- 4.0
- Author:
- Artem Bilan, Gary Russell
- See Also:
- 
Optional Element SummaryOptional ElementsModifier and TypeOptional ElementDescriptionProvides custom message headers.An expression that will be used to generate thepayloadfor all methods in the service interface unless explicitly overridden by a method declaration.Identifies the default channel the gateway proxy will subscribe to, to receive replyMessages, the payloads of which will be converted to the return type of the method signature.Allows to specify how long this gateway will wait for the replyMessagebefore returning.Identifies the default channel to which messages will be sent upon invocation of methods of the gateway proxy.Provides the amount of time dispatcher would wait to send aMessage.Identifies a channel that error messages will be sent to if a failure occurs in the gateway's proxy invocation.booleanIf errorOnTimeout is true, null won't be returned as a result of a gateway method invocation when a timeout occurs.AnMethodArgsMessageMapperto map the method arguments to aMessage.The value may indicate a suggestion for a logical component name, to be turned into a Spring bean in case of an autodetected component.booleanIndicate ifdefaultmethods on the interface should be proxied as well.The value may indicate a suggestion for a logical component name, to be turned into a Spring bean in case of an autodetected component.
- 
Element Details- 
valueThe value may indicate a suggestion for a logical component name, to be turned into a Spring bean in case of an autodetected component.- Returns:
- the suggested component name, if any
- Since:
- 6.0
 - Default:
- ""
 
- 
nameThe value may indicate a suggestion for a logical component name, to be turned into a Spring bean in case of an autodetected component.- Returns:
- the suggested component name, if any
 - Default:
- ""
 
- 
defaultRequestChannelString defaultRequestChannelIdentifies the default channel to which messages will be sent upon invocation of methods of the gateway proxy. SeeGateway.requestChannel()for per-method configuration.- Returns:
- the suggested channel name, if any
 - Default:
- ""
 
- 
defaultReplyChannelString defaultReplyChannelIdentifies the default channel the gateway proxy will subscribe to, to receive replyMessages, the payloads of which will be converted to the return type of the method signature. SeeGateway.replyChannel()for per-method configuration.- Returns:
- the suggested channel name, if any
 - Default:
- ""
 
- 
errorChannelString errorChannelIdentifies a channel that error messages will be sent to if a failure occurs in the gateway's proxy invocation. If noerrorChannelreference is provided, the gateway will propagateExceptions to the caller. To completely suppressExceptions, provide a reference to thenullChannelhere.- Returns:
- the suggested channel name, if any
 - Default:
- ""
 
- 
defaultRequestTimeoutString defaultRequestTimeoutProvides the amount of time dispatcher would wait to send aMessage. 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 aQueueChannel. Value is specified in milliseconds; it can be a simple long value or a SpEL expression; array variable #args is available. SeeGateway.requestTimeout()for per-method configuration.- Returns:
- the suggested timeout in milliseconds, if any
 - Default:
- "30000"
 
- 
defaultReplyTimeoutString defaultReplyTimeoutAllows to specify how long this gateway will wait for the replyMessagebefore returning. Thenullis 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. SeeGateway.replyTimeout()for per-method configuration.- Returns:
- the suggested timeout in milliseconds, if any
 - Default:
- "30000"
 
- 
asyncExecutorString asyncExecutorProvide a reference to an implementation ofExecutorto use for any of the interface methods that have aFuturereturn type. ThisExecutorwill only be used for those async methods; the sync methods will be invoked in the caller's thread. UseAnnotationConstants.NULLto specify no async executor - for example if your downstream flow returns aFuture.- Returns:
- the suggested executor bean name, if any
 - Default:
- ""
 
- 
defaultPayloadExpressionString defaultPayloadExpressionAn expression that will be used to generate thepayloadfor all methods in the service interface unless explicitly overridden by a method declaration. Variables include#args,#methodName,#methodStringand#methodObject; a bean resolver is also available, enabling expressions like@someBean(#args). SeeGateway.payloadExpression()for per-method configuration.- Returns:
- the suggested payload expression, if any
 - Default:
- ""
 
- 
defaultHeadersGatewayHeader[] defaultHeadersProvides custom message headers. These default headers are created for all methods on the service-interface (unless overridden by a specific method). SeeGateway.headers()for per-method configuration.- Returns:
- the suggested payload expression, if any
 - Default:
- {}
 
- 
mapperString mapperAnMethodArgsMessageMapperto map the method arguments to aMessage. When this is provided, nopayload-expressions orheaders are allowed; the custom mapper is responsible for creating the message.- Returns:
- the suggested mapper bean name, if any
 - Default:
- ""
 
- 
proxyDefaultMethodsboolean proxyDefaultMethodsIndicate ifdefaultmethods on the interface should be proxied as well. If an explicitGatewayannotation is present on method it is proxied independently of this option. Note: default methods in JDK classes (such asFunction) can be proxied, but cannot be invoked viaMethodHandleby an internal Java security restriction forMethodHandle.Lookup.- Returns:
- the boolean flag to proxy default methods or invoke via MethodHandle.
- Since:
- 5.3
 - Default:
- false
 
- 
errorOnTimeoutboolean errorOnTimeoutIf errorOnTimeout is true, null won't be returned as a result of a gateway method invocation when a timeout occurs. Instead, aMessageTimeoutExceptionis thrown or an error message is published to the error channel.- Since:
- 6.2
- See Also:
 - Default:
- false
 
 
-