@IntegrationManagedResource public abstract class MessagingGatewaySupport extends AbstractEndpoint implements TrackableComponent, MessageSourceMetrics
MessageChannels for sending, receiving, or request-reply operations.
Exposes setters for configuring request and reply MessageChannels as
well as the timeout values for sending and receiving Messages.lifecycleCondition, lifecycleLocklogger| Constructor and Description |
|---|
MessagingGatewaySupport()
Construct an instance that will return null if no reply is received.
|
MessagingGatewaySupport(boolean errorOnTimeout)
If errorOnTimeout is true, construct an instance that will send an
ErrorMessage with a MessageTimeoutException payload to the error
channel if a reply is expected but none is received. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doStart()
Subclasses must implement this method with the start behavior.
|
protected void |
doStop()
Subclasses must implement this method with the stop behavior.
|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected MessageChannel |
getErrorChannel() |
String |
getManagedName() |
String |
getManagedType() |
int |
getMessageCount() |
long |
getMessageCountLong() |
protected MessageChannel |
getReplyChannel() |
MessageChannel |
getRequestChannel() |
boolean |
isCountsEnabled() |
boolean |
isLoggingEnabled() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected Object |
receive() |
void |
reset() |
protected void |
send(Object object) |
protected Object |
sendAndReceive(Object object) |
protected Message<?> |
sendAndReceiveMessage(Object object) |
void |
setCountsEnabled(boolean countsEnabled) |
void |
setErrorChannel(MessageChannel errorChannel)
Set the error channel.
|
void |
setErrorChannelName(String errorChannelName)
Set the error channel name.
|
void |
setLoggingEnabled(boolean enabled) |
void |
setManagedName(String name) |
void |
setManagedType(String type) |
void |
setReplyChannel(MessageChannel replyChannel)
Set the reply channel.
|
void |
setReplyChannelName(String replyChannelName)
Set the reply channel name.
|
void |
setReplyMapper(OutboundMessageMapper<?> replyMapper)
Provide an
OutboundMessageMapper for mapping to objects from
any reply Messages received in receive or sendAndReceive operations. |
void |
setReplyTimeout(long replyTimeout)
Set the timeout value for receiving reply messages.
|
void |
setRequestChannel(MessageChannel requestChannel)
Set the request channel.
|
void |
setRequestChannelName(String requestChannelName)
Set the request channel name.
|
void |
setRequestMapper(InboundMessageMapper<?> requestMapper)
Provide an
InboundMessageMapper for creating request Messages
from any object passed in a send or sendAndReceive operation. |
void |
setRequestTimeout(long requestTimeout)
Set the timeout value for sending request messages.
|
void |
setShouldTrack(boolean shouldTrack)
Specify whether this gateway should be tracked in the Message History
of Messages that originate from its send or sendAndReceive operations.
|
doStop, getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stopafterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetComponentNamepublic MessagingGatewaySupport()
public MessagingGatewaySupport(boolean errorOnTimeout)
ErrorMessage with a MessageTimeoutException payload to the error
channel if a reply is expected but none is received. If no error channel is
configured, the MessageTimeoutException will be thrown.errorOnTimeout - true to create the error message.public void setRequestChannel(MessageChannel requestChannel)
requestChannel - the channel to which request messages will be sentpublic void setRequestChannelName(String requestChannelName)
requestChannelName - the channel bean name to which request messages will be sentpublic void setReplyChannel(MessageChannel replyChannel)
replyChannel - the channel from which reply messages will be receivedpublic void setReplyChannelName(String replyChannelName)
replyChannelName - the channel bean name from which reply messages will be receivedpublic void setErrorChannel(MessageChannel errorChannel)
errorChannel - The error channel.public void setErrorChannelName(String errorChannelName)
errorChannelName - The error channel bean name.public void setRequestTimeout(long requestTimeout)
requestTimeout - the timeout value in millisecondspublic void setReplyTimeout(long replyTimeout)
replyTimeout - the timeout value in millisecondspublic void setRequestMapper(InboundMessageMapper<?> requestMapper)
InboundMessageMapper for creating request Messages
from any object passed in a send or sendAndReceive operation.requestMapper - The request mapper.public void setReplyMapper(OutboundMessageMapper<?> replyMapper)
OutboundMessageMapper for mapping to objects from
any reply Messages received in receive or sendAndReceive operations.replyMapper - The reply mapper.public void setShouldTrack(boolean shouldTrack)
setShouldTrack in interface TrackableComponentpublic int getMessageCount()
getMessageCount in interface MessageSourceMetricspublic long getMessageCountLong()
getMessageCountLong in interface MessageSourceMetricspublic void setManagedName(String name)
setManagedName in interface MessageSourceMetricspublic String getManagedName()
getManagedName in interface MessageSourceMetricspublic void setManagedType(String type)
setManagedType in interface MessageSourceMetricspublic String getManagedType()
getManagedType in interface MessageSourceMetricspublic String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class IntegrationObjectSupportpublic void setLoggingEnabled(boolean enabled)
setLoggingEnabled in interface IntegrationManagementpublic boolean isLoggingEnabled()
isLoggingEnabled in interface IntegrationManagementpublic void setCountsEnabled(boolean countsEnabled)
setCountsEnabled in interface IntegrationManagementpublic boolean isCountsEnabled()
isCountsEnabled in interface IntegrationManagementprotected void onInit()
throws Exception
IntegrationObjectSupportonInit in class IntegrationObjectSupportException - Any exception.public MessageChannel getRequestChannel()
protected MessageChannel getReplyChannel()
protected MessageChannel getErrorChannel()
protected void send(Object object)
protected Object receive()
protected void doStart()
AbstractEndpointAbstractEndpoint.lifecycleLock.doStart in class AbstractEndpointprotected void doStop()
AbstractEndpointAbstractEndpoint.lifecycleLock.doStop in class AbstractEndpointpublic void reset()
reset in interface IntegrationManagement