Class GatewayProxySpec
java.lang.Object
org.springframework.integration.dsl.GatewayProxySpec
- All Implemented Interfaces:
ComponentsRegistration
A builder for the
GatewayProxyFactoryBean
options
when MessagingGateway
on the service interface cannot be
declared.- Since:
- 5.2
- Author:
- Artem Bilan, Gary Russell
-
Field Summary
Modifier and TypeFieldDescriptionprotected final GatewayMethodMetadata
protected final GatewayProxyFactoryBean
protected final MessageChannel
protected final Map<String,
Expression> protected static final SpelExpressionParser
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasyncExecutor
(Executor executor) Specify a bean name for the targetGatewayProxyFactoryBean
.errorChannel
(String errorChannelName) Identifies a channel that error messages will be sent to if a failure occurs in the gateway's proxy invocation.errorChannel
(MessageChannel errorChannel) Identifies a channel that error messages will be sent to if a failure occurs in the gateway's proxy invocation.Provides custom message header.header
(String headerName, Function<MethodArgsHolder, ?> valueFunction) Provides custom message header.header
(String headerName, Expression valueExpression) Provides custom message header.mapper
(MethodArgsMessageMapper mapper) AnMethodArgsMessageMapper
to map the method arguments to aMessage
.payloadExpression
(String expression) An expression that will be used to generate thepayload
for all methods in the service interface unless explicitly overridden by a method declaration.payloadExpression
(Expression expression) An expression that will be used to generate thepayload
for all methods in the service interface unless explicitly overridden by a method declaration.payloadFunction
(Function<MethodArgsHolder, ?> defaultPayloadFunction) AFunction
that will be used to generate thepayload
for all methods in the service interface unless explicitly overridden by a method declaration.proxyDefaultMethods
(boolean proxyDefaultMethods) Indicate ifdefault
methods on the interface should be proxied as well.replyChannel
(String channelName) Identifies the default channel the gateway proxy will subscribe to, to receive replyMessage
s, the payloads of which will be converted to the return type of the method signature.replyChannel
(MessageChannel replyChannel) Identifies the default channel the gateway proxy will subscribe to, to receive replyMessage
s, the payloads of which will be converted to the return type of the method signature.replyTimeout
(long replyTimeout) Allows to specify how long this gateway will wait for the replyMessage
before returning.requestTimeout
(long requestTimeout) Provides the amount of time dispatcher would wait to send aMessage
.
-
Field Details
-
PARSER
-
gatewayRequestChannel
-
gatewayProxyFactoryBean
-
gatewayMethodMetadata
-
headerExpressions
-
-
Constructor Details
-
GatewayProxySpec
-
-
Method Details
-
beanName
Specify a bean name for the targetGatewayProxyFactoryBean
.- Parameters:
beanName
- the bean name to be used for registering bean for the gateway proxy- Returns:
- current
GatewayProxySpec
.
-
replyChannel
Identifies the default channel the gateway proxy will subscribe to, to receive replyMessage
s, the payloads of which will be converted to the return type of the method signature.- Parameters:
channelName
- the bean name forMessageChannel
- Returns:
- current
GatewayProxySpec
. - See Also:
-
replyChannel
Identifies the default channel the gateway proxy will subscribe to, to receive replyMessage
s, the payloads of which will be converted to the return type of the method signature.- Parameters:
replyChannel
- theMessageChannel
for replies.- Returns:
- current
GatewayProxySpec
. - See Also:
-
errorChannel
Identifies a channel that error messages will be sent to if a failure occurs in the gateway's proxy invocation. If noerrorChannel
reference is provided, the gateway will propagateException
s to the caller. To completely suppressException
s, provide a reference to thenullChannel
here.- Parameters:
errorChannelName
- the bean name forMessageChannel
- Returns:
- current
GatewayProxySpec
. - See Also:
-
errorChannel
Identifies a channel that error messages will be sent to if a failure occurs in the gateway's proxy invocation. If noerrorChannel
reference is provided, the gateway will propagateException
s to the caller. To completely suppressException
s, provide a reference to thenullChannel
here.- Parameters:
errorChannel
- theMessageChannel
for replies.- Returns:
- current
GatewayProxySpec
. - See Also:
-
requestTimeout
Provides 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.- Parameters:
requestTimeout
- the timeout for requests in milliseconds.- Returns:
- current
GatewayProxySpec
. - See Also:
-
replyTimeout
Allows to specify how long this gateway will wait for the replyMessage
before returning. By default it will wait indefinitely.null
is returned if the gateway times out. Value is specified in milliseconds.- Parameters:
replyTimeout
- the timeout for replies in milliseconds.- Returns:
- current
GatewayProxySpec
. - See Also:
-
asyncExecutor
Provide a reference to an implementation ofExecutor
to use for any of the interface methods that have aFuture
return type. ThisExecutor
will only be used for those async methods; the sync methods will be invoked in the caller's thread. Usenull
to specify no async executor - for example if your downstream flow returns aFuture
.- Parameters:
executor
- theExecutor
to use.- Returns:
- current
GatewayProxySpec
. - See Also:
-
payloadExpression
An expression that will be used to generate thepayload
for all methods in the service interface unless explicitly overridden by a method declaration. The root object for evaluation context isMethodArgsHolder
.- Parameters:
expression
- the SpEL expression for default payload.- Returns:
- current
GatewayProxySpec
. - See Also:
-
payloadFunction
AFunction
that will be used to generate thepayload
for all methods in the service interface unless explicitly overridden by a method declaration.- Parameters:
defaultPayloadFunction
- theFunction
for default payload.- Returns:
- current
GatewayProxySpec
. - See Also:
-
payloadExpression
An expression that will be used to generate thepayload
for all methods in the service interface unless explicitly overridden by a method declaration. The root object for evaluation context isMethodArgsHolder
. a bean resolver is also available, enabling expressions like@someBean(#args)
.- Parameters:
expression
- the SpEL expression for default payload.- Returns:
- current
GatewayProxySpec
. - See Also:
-
header
Provides custom message header. The default headers are created for all methods on the service-interface (unless overridden by a specific method).- Parameters:
headerName
- the name ofr the header.value
- the static value for the header.- Returns:
- current
GatewayProxySpec
. - See Also:
-
header
Provides custom message header. The default headers are created for all methods on the service-interface (unless overridden by a specific method).- Parameters:
headerName
- the name ofr the header.valueFunction
- theFunction
for the header value.- Returns:
- current
GatewayProxySpec
. - See Also:
-
header
Provides custom message header. The default headers are created for all methods on the service-interface (unless overridden by a specific method). This expression-based header can get access to theMethodArgsHolder
as a root object for evaluation context.- Parameters:
headerName
- the name ofr the header.valueExpression
- the SpEL expression for the header value.- Returns:
- current
GatewayProxySpec
. - See Also:
-
mapper
AnMethodArgsMessageMapper
to map the method arguments to aMessage
. When this is provided, nopayload-expression
s orheader
s are allowed; the custom mapper is responsible for creating the message.- Parameters:
mapper
- theMethodArgsMessageMapper
to use.- Returns:
- current
GatewayProxySpec
. - See Also:
-
proxyDefaultMethods
Indicate ifdefault
methods on the interface should be proxied as well.- Parameters:
proxyDefaultMethods
- the boolean flag to proxy default methods or invoke viaMethodHandle
.- Returns:
- current
GatewayProxySpec
. - Since:
- 5.3
- See Also:
-
getComponentsToRegister
- Specified by:
getComponentsToRegister
in interfaceComponentsRegistration
-