Annotation Interface Gateway
GatewayProxyFactoryBean
where the annotation attributes can override the default channel settings.
A method annotated with @Gateway may accept a single non-annotated
parameter of type Message
or of the intended Message payload type. Method parameters may be mapped
to individual Message header values by using the
@Header
parameter annotation. Alternatively, to pass the entire Message headers
map, a Map-typed parameter may be annotated with
Headers
.
Return values from the annotated method may be of any type. If the
declared return value is not a Message, the reply Message's payload will be
returned and any type conversion as supported by Spring's
SimpleTypeConverter
will be applied to
the return value if necessary.
Note: unlike @Publisher, this annotation is for exposing a Messaging Endpoint based on a Proxy for the marked interface method. The method invocation causes messaging interaction using an AOP Advice. Method parameters become the part of sent message (payload, headers). The method return value is the result (payload) of the messaging flow invoked by the Proxy.
- Author:
- Mark Fisher, Gary Russell, Artem Bilan
- See Also:
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionSpecify additional headers that will be added to the request message.Specify a SpEL expression to determine the payload of the request message.Specify the channel from which reply messages will be received; overrides the encompassing gateway's default reply channel.long
Specify the time (ms) that the thread sending the request will wait for a reply.Specify a SpEL Expression to determine the time (ms) that the thread sending the request will wait for a reply.Specify the channel to which messages will be sent; overrides the encompassing gateway's default request channel.long
Specify the timeout (ms) when sending to the request channel - only applies if the send might block (such as a boundedQueueChannel
that is currently full.Specify a SpEL Expression to determine the timeout (ms) when sending to the request channel - only applies if the send might block (such as a boundedQueueChannel
that is currently full.
-
Element Details
-
requestChannel
String requestChannelSpecify the channel to which messages will be sent; overrides the encompassing gateway's default request channel.- Returns:
- the channel name.
- Default:
- ""
-
replyChannel
String replyChannelSpecify the channel from which reply messages will be received; overrides the encompassing gateway's default reply channel.- Returns:
- the channel name.
- Default:
- ""
-
requestTimeout
long requestTimeoutSpecify the timeout (ms) when sending to the request channel - only applies if the send might block (such as a boundedQueueChannel
that is currently full. Overrides the encompassing gateway's default request timeout.- Returns:
- the timeout.
- See Also:
- Default:
- 30000L
-
requestTimeoutExpression
String requestTimeoutExpressionSpecify a SpEL Expression to determine the timeout (ms) when sending to the request channel - only applies if the send might block (such as a boundedQueueChannel
that is currently full. Overrides the encompassing gateway's default request timeout. OverridesrequestTimeout()
.- Returns:
- the timeout.
- Since:
- 5.0
- Default:
- ""
-
replyTimeout
long replyTimeoutSpecify the time (ms) that the thread sending the request will wait for a reply. The timer starts when the thread returns to the gateway, not when the request message is sent. Overrides the encompassing gateway's default reply timeout.- Returns:
- the timeout.
- See Also:
- Default:
- 30000L
-
replyTimeoutExpression
String replyTimeoutExpressionSpecify a SpEL Expression to determine the time (ms) that the thread sending the request will wait for a reply. The timer starts when the thread returns to the gateway, not when the request message is sent. Overrides the encompassing gateway's default reply timeout. OverridesreplyTimeout()
.- Returns:
- the timeout.
- Since:
- 5.0
- Default:
- ""
-
payloadExpression
String payloadExpressionSpecify a SpEL expression to determine the payload of the request message.- Returns:
- the expression.
- Default:
- ""
-
headers
GatewayHeader[] headersSpecify additional headers that will be added to the request message.- Returns:
- the headers.
- Default:
- {}
-