public class GatewayProxyFactoryBean extends AbstractEndpoint implements TrackableComponent, FactoryBean<Object>, MethodInterceptor, BeanClassLoaderAware
ConversionService set on the enclosing BeanFactory
under the name
IntegrationUtils.INTEGRATION_CONVERSION_SERVICE_BEAN_NAME
to
perform type conversions when necessary (thanks to Jon Schneider's contribution and suggestion in INT-1230).lifecycleCondition, lifecycleLockEXPRESSION_PARSER, loggerOBJECT_TYPE_ATTRIBUTEDEFAULT_PHASE| Constructor and Description |
|---|
GatewayProxyFactoryBean()
Create a Factory whose service interface type can be configured by setter injection.
|
GatewayProxyFactoryBean(Class<?> serviceInterface) |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
protected Object |
doInvoke(MethodInvocation invocation,
boolean runningOnCallerThread) |
protected void |
doStart()
Subclasses must implement this method with the start behavior.
|
protected void |
doStop()
Subclasses must implement this method with the stop behavior.
|
protected AsyncTaskExecutor |
getAsyncExecutor() |
protected MessageChannel |
getDefaultReplyChannel() |
protected String |
getDefaultReplyChannelName() |
protected Expression |
getDefaultReplyTimeout() |
protected MessageChannel |
getDefaultRequestChannel() |
protected String |
getDefaultRequestChannelName() |
protected Expression |
getDefaultRequestTimeout() |
protected MessageChannel |
getErrorChannel() |
protected String |
getErrorChannelName() |
Map<Method,MessagingGatewaySupport> |
getGateways()
Return the Map of
Method to MessagingGatewaySupport
generated by this factory bean. |
protected GatewayMethodMetadata |
getGlobalMethodMetadata() |
protected MethodArgsMessageMapper |
getMapper() |
Object |
getObject() |
Class<?> |
getObjectType() |
Object |
invoke(MethodInvocation invocation) |
protected boolean |
isAsyncExecutorExplicitlySet() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
setAsyncExecutor(Executor executor)
Set the executor for use when the gateway method returns
Future or ListenableFuture. |
void |
setBeanClassLoader(ClassLoader beanClassLoader) |
void |
setDefaultReplyChannel(MessageChannel defaultReplyChannel)
Set the default reply channel.
|
void |
setDefaultReplyChannelName(String defaultReplyChannelName)
Set the default reply channel bean name.
|
void |
setDefaultReplyTimeout(Long defaultReplyTimeout)
Set the default timeout value for receiving reply messages.
|
void |
setDefaultReplyTimeoutExpression(Expression defaultReplyTimeout)
Set an expression to be evaluated to determine the default timeout value for
receiving reply messages.
|
void |
setDefaultReplyTimeoutExpressionString(String defaultReplyTimeout)
Set an expression to be evaluated to determine the default timeout value for
receiving reply messages.
|
void |
setDefaultRequestChannel(MessageChannel defaultRequestChannel)
Set the default request channel.
|
void |
setDefaultRequestChannelName(String defaultRequestChannelName)
Set the default request channel bean name.
|
void |
setDefaultRequestTimeout(Long defaultRequestTimeout)
Set the default timeout value for sending request messages.
|
void |
setDefaultRequestTimeoutExpression(Expression defaultRequestTimeout)
Set an expression to be evaluated to determine the default timeout value for
sending request messages.
|
void |
setDefaultRequestTimeoutExpressionString(String defaultRequestTimeout)
Set an expression to be evaluated to determine the default timeout value for
sending request messages.
|
void |
setErrorChannel(MessageChannel errorChannel)
Set the error channel.
|
void |
setErrorChannelName(String errorChannelName)
Set the error channel name.
|
void |
setGlobalMethodMetadata(GatewayMethodMetadata globalMethodMetadata) |
void |
setMapper(MethodArgsMessageMapper mapper)
|
void |
setMethodMetadataMap(Map<String,GatewayMethodMetadata> methodMetadataMap) |
void |
setProxyDefaultMethods(boolean proxyDefaultMethods)
Indicate if
default methods on the interface should be proxied as well. |
void |
setShouldTrack(boolean shouldTrack) |
void |
setTypeConverter(TypeConverter typeConverter) |
doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBeanName, getComponentName, getComponentTypeisSingletonpublic GatewayProxyFactoryBean()
RequestReplyExchanger, upon initialization.public GatewayProxyFactoryBean(Class<?> serviceInterface)
public void setDefaultRequestChannel(MessageChannel defaultRequestChannel)
defaultRequestChannel - the channel to which request messages will
be sent if no request channel has been configured with an annotation.public void setDefaultRequestChannelName(String defaultRequestChannelName)
defaultRequestChannelName - the channel name to which request messages will
be sent if no request channel has been configured with an annotation.@Nullable protected MessageChannel getDefaultRequestChannel()
public void setDefaultReplyChannel(MessageChannel defaultReplyChannel)
defaultReplyChannel - the channel from which reply messages will be
received if no reply channel has been configured with an annotationpublic void setDefaultReplyChannelName(String defaultReplyChannelName)
defaultReplyChannelName - the channel name from which reply messages will be
received if no reply channel has been configured with an annotation@Nullable protected MessageChannel getDefaultReplyChannel()
public void setErrorChannel(MessageChannel errorChannel)
errorChannel - The error channel.public void setErrorChannelName(String errorChannelName)
errorChannelName - The error channel bean name.@Nullable protected MessageChannel getErrorChannel()
public void setDefaultRequestTimeout(Long defaultRequestTimeout)
defaultRequestTimeout - the timeout value in millisecondspublic void setDefaultRequestTimeoutExpression(Expression defaultRequestTimeout)
defaultRequestTimeout - the timeout value in millisecondspublic void setDefaultRequestTimeoutExpressionString(String defaultRequestTimeout)
defaultRequestTimeout - the timeout value in milliseconds@Nullable protected Expression getDefaultRequestTimeout()
public void setDefaultReplyTimeout(Long defaultReplyTimeout)
defaultReplyTimeout - the timeout value in millisecondspublic void setDefaultReplyTimeoutExpression(Expression defaultReplyTimeout)
defaultReplyTimeout - the timeout value in millisecondspublic void setDefaultReplyTimeoutExpressionString(String defaultReplyTimeout)
defaultReplyTimeout - the timeout value in milliseconds@Nullable protected Expression getDefaultReplyTimeout()
public void setShouldTrack(boolean shouldTrack)
setShouldTrack in interface TrackableComponentpublic void setAsyncExecutor(@Nullable Executor executor)
Future or ListenableFuture.
Set it to null to disable the async processing, and any
Future return types must be returned by the downstream flow.executor - The executor.public void setTypeConverter(TypeConverter typeConverter)
public void setMethodMetadataMap(Map<String,GatewayMethodMetadata> methodMetadataMap)
public void setGlobalMethodMetadata(GatewayMethodMetadata globalMethodMetadata)
@Nullable protected GatewayMethodMetadata getGlobalMethodMetadata()
public void setBeanClassLoader(ClassLoader beanClassLoader)
setBeanClassLoader in interface BeanClassLoaderAwarepublic final void setMapper(MethodArgsMessageMapper mapper)
mapper - the mapper.@Nullable protected MethodArgsMessageMapper getMapper()
public void setProxyDefaultMethods(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.proxyDefaultMethods - the boolean flag to proxy default methods or invoke via MethodHandle.@Nullable protected AsyncTaskExecutor getAsyncExecutor()
protected boolean isAsyncExecutorExplicitlySet()
public Map<Method,MessagingGatewaySupport> getGateways()
Method to MessagingGatewaySupport
generated by this factory bean.protected void onInit()
IntegrationObjectSupportonInit in class AbstractEndpointpublic Class<?> getObjectType()
getObjectType in interface FactoryBean<Object>public Object getObject()
getObject in interface FactoryBean<Object>@Nullable public Object invoke(MethodInvocation invocation) throws Throwable
invoke in interface MethodInterceptorThrowable@Nullable protected Object doInvoke(MethodInvocation invocation, boolean runningOnCallerThread) throws Throwable
Throwableprotected void doStart()
AbstractEndpointAbstractEndpoint.lifecycleLock.doStart in class AbstractEndpointprotected void doStop()
AbstractEndpointAbstractEndpoint.lifecycleLock.doStop in class AbstractEndpointpublic void destroy()
destroy in interface DisposableBeandestroy in class AbstractEndpoint