Class GatewayProxySpec
java.lang.Object
org.springframework.integration.dsl.GatewayProxySpec
- All Implemented Interfaces:
ComponentsRegistration
public class GatewayProxySpec extends Object implements 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
Fields Modifier and Type Field Description protected GatewayMethodMetadata
gatewayMethodMetadata
protected GatewayProxyFactoryBean
gatewayProxyFactoryBean
protected MessageChannel
gatewayRequestChannel
protected Map<String,Expression>
headerExpressions
protected static SpelExpressionParser
PARSER
-
Constructor Summary
Constructors Modifier Constructor Description protected
GatewayProxySpec(Class<?> serviceInterface)
-
Method Summary
Modifier and Type Method Description GatewayProxySpec
asyncExecutor(Executor executor)
GatewayProxySpec
beanName(String beanName)
Specify a bean name for the targetGatewayProxyFactoryBean
.GatewayProxySpec
errorChannel(String errorChannelName)
Identifies a channel that error messages will be sent to if a failure occurs in the gateway's proxy invocation.GatewayProxySpec
errorChannel(MessageChannel errorChannel)
Identifies a channel that error messages will be sent to if a failure occurs in the gateway's proxy invocation.Map<Object,String>
getComponentsToRegister()
GatewayProxySpec
header(String headerName, Object value)
Provides custom message header.GatewayProxySpec
header(String headerName, Function<MethodArgsHolder,?> valueFunction)
Provides custom message header.GatewayProxySpec
header(String headerName, Expression valueExpression)
Provides custom message header.GatewayProxySpec
mapper(MethodArgsMessageMapper mapper)
AnMethodArgsMessageMapper
to map the method arguments to aMessage
.GatewayProxySpec
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.GatewayProxySpec
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.GatewayProxySpec
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.GatewayProxySpec
proxyDefaultMethods(boolean proxyDefaultMethods)
Indicate ifdefault
methods on the interface should be proxied as well.GatewayProxySpec
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.GatewayProxySpec
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.GatewayProxySpec
replyTimeout(long replyTimeout)
Allows to specify how long this gateway will wait for the replyMessage
before returning.GatewayProxySpec
requestTimeout(long requestTimeout)
Provides the amount of time dispatcher would wait to send aMessage
.
-
Field Details
-
Constructor Details
-
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:
GatewayProxyFactoryBean.setDefaultReplyChannel(org.springframework.messaging.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.- Parameters:
replyChannel
- theMessageChannel
for replies.- Returns:
- current
GatewayProxySpec
. - See Also:
GatewayProxyFactoryBean.setDefaultReplyChannel(org.springframework.messaging.MessageChannel)
-
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:
GatewayProxyFactoryBean.setErrorChannel(org.springframework.messaging.MessageChannel)
-
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:
GatewayProxyFactoryBean.setErrorChannel(org.springframework.messaging.MessageChannel)
-
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:
GatewayProxyFactoryBean.setDefaultRequestTimeout(java.lang.Long)
-
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:
GatewayProxyFactoryBean.setDefaultReplyTimeout(java.lang.Long)
-
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:
GatewayProxyFactoryBean.setAsyncExecutor(java.util.concurrent.Executor)
-
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:
MessagingGateway.defaultPayloadExpression()
-
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:
MessagingGateway.defaultPayloadExpression()
-
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:
MessagingGateway.defaultPayloadExpression()
-
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:
MessagingGateway.defaultHeaders()
-
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:
MessagingGateway.defaultHeaders()
-
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:
MessagingGateway.defaultHeaders()
-
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:
GatewayProxyFactoryBean.setMapper(MethodArgsMessageMapper)
-
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:
GatewayProxyFactoryBean.setProxyDefaultMethods(boolean)
-
getComponentsToRegister
- Specified by:
getComponentsToRegister
in interfaceComponentsRegistration
-