Class AbstractAmqpChannel
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.amqp.channel.AbstractAmqpChannel
- All Implemented Interfaces:
org.springframework.amqp.rabbit.connection.ConnectionListener
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,org.springframework.integration.context.ExpressionCapable
,org.springframework.integration.IntegrationPattern
,org.springframework.integration.support.context.NamedComponent
,org.springframework.integration.support.management.IntegrationManagement
,org.springframework.integration.support.management.TrackableComponent
,org.springframework.messaging.MessageChannel
,org.springframework.messaging.support.InterceptableChannel
- Direct Known Subclasses:
PointToPointSubscribableAmqpChannel
,PollableAmqpChannel
,PublishSubscribeAmqpChannel
public abstract class AbstractAmqpChannel
extends org.springframework.integration.channel.AbstractMessageChannel
implements org.springframework.amqp.rabbit.connection.ConnectionListener
The base
AbstractMessageChannel
implementation for AMQP.- Since:
- 2.1
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.springframework.integration.channel.AbstractMessageChannel
interceptors, meters
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Method Summary
Modifier and Type Method Description void
destroy()
protected abstract void
doDeclares()
protected boolean
doSend(org.springframework.messaging.Message<?> message, long timeout)
protected org.springframework.amqp.core.AmqpAdmin
getAdmin()
protected org.springframework.amqp.core.AmqpTemplate
getAmqpTemplate()
protected org.springframework.amqp.rabbit.connection.ConnectionFactory
getConnectionFactory()
protected java.lang.String
getExchangeName()
Subclasses may override this method to return an Exchange name.protected AmqpHeaderMapper
getInboundHeaderMapper()
protected org.springframework.amqp.rabbit.core.RabbitTemplate
getRabbitTemplate()
protected java.lang.String
getRoutingKey()
Subclasses may override this method to return a routing key.protected boolean
isExtractPayload()
boolean
isLoggingEnabled()
void
onClose(org.springframework.amqp.rabbit.connection.Connection connection)
void
onCreate(org.springframework.amqp.rabbit.connection.Connection connection)
protected void
onInit()
protected void
setAdmin(org.springframework.amqp.core.AmqpAdmin admin)
protected void
setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)
void
setDefaultDeliveryMode(org.springframework.amqp.core.MessageDeliveryMode defaultDeliveryMode)
Set the delivery mode to use if the message has no "amqp_deliveryMode" header and the message property was not set by theMessagePropertiesConverter
.void
setExtractPayload(boolean extractPayload)
Set to true to extract the payload and map the headers; otherwise the entire message is converted and sent.void
setHeadersMappedLast(boolean headersMappedLast)
When mapping headers for the outbound message, determine whether the headers are mapped before the message is converted, or afterwards.void
setLoggingEnabled(boolean loggingEnabled)
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
addInterceptor, addInterceptor, getComponentType, getFullChannelName, getIChannelInterceptorList, getIntegrationPatternType, getInterceptors, getMetricsCaptor, getOverrides, registerMetricsCaptor, removeInterceptor, removeInterceptor, send, send, setDatatypes, setInterceptors, setMessageConverter, setShouldTrack
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.amqp.rabbit.connection.ConnectionListener
onFailed, onShutDown
-
Method Details
-
isLoggingEnabled
public boolean isLoggingEnabled()- Specified by:
isLoggingEnabled
in interfaceorg.springframework.integration.support.management.IntegrationManagement
- Overrides:
isLoggingEnabled
in classorg.springframework.integration.channel.AbstractMessageChannel
-
setLoggingEnabled
public void setLoggingEnabled(boolean loggingEnabled)- Specified by:
setLoggingEnabled
in interfaceorg.springframework.integration.support.management.IntegrationManagement
- Overrides:
setLoggingEnabled
in classorg.springframework.integration.channel.AbstractMessageChannel
-
setDefaultDeliveryMode
public void setDefaultDeliveryMode(org.springframework.amqp.core.MessageDeliveryMode defaultDeliveryMode)Set the delivery mode to use if the message has no "amqp_deliveryMode" header and the message property was not set by theMessagePropertiesConverter
.- Parameters:
defaultDeliveryMode
- the default delivery mode.- Since:
- 4.3
-
setExtractPayload
public void setExtractPayload(boolean extractPayload)Set to true to extract the payload and map the headers; otherwise the entire message is converted and sent. Default false.- Parameters:
extractPayload
- true to extract and map.- Since:
- 4.3
-
isExtractPayload
protected boolean isExtractPayload()- Returns:
- the extract payload.
- Since:
- 4.3
- See Also:
setExtractPayload(boolean)
-
setHeadersMappedLast
public void setHeadersMappedLast(boolean headersMappedLast)When mapping headers for the outbound message, determine whether the headers are mapped before the message is converted, or afterwards. This only affects headers that might be added by the message converter. When false, the converter's headers win; when true, any headers added by the converter will be overridden (if the source message has a header that maps to those headers). You might wish to set this to true, for example, when using aSimpleMessageConverter
with a String payload that contains json; the converter will set the content type totext/plain
which can be overridden toapplication/json
by setting theAmqpHeaders.CONTENT_TYPE
message header. Only applies whenextractPayload
is true. Default: false.- Parameters:
headersMappedLast
- true if headers are mapped after conversion.- Since:
- 5.0
-
getExchangeName
protected java.lang.String getExchangeName()Subclasses may override this method to return an Exchange name. By default, Messages will be sent to the no-name Direct Exchange.- Returns:
- The exchange name.
-
getRoutingKey
protected java.lang.String getRoutingKey()Subclasses may override this method to return a routing key. By default, there will be no routing key (empty string).- Returns:
- The routing key.
-
getInboundHeaderMapper
-
getAmqpTemplate
protected org.springframework.amqp.core.AmqpTemplate getAmqpTemplate() -
getRabbitTemplate
protected org.springframework.amqp.rabbit.core.RabbitTemplate getRabbitTemplate() -
setAdmin
protected final void setAdmin(org.springframework.amqp.core.AmqpAdmin admin) -
setConnectionFactory
protected final void setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory) -
getAdmin
protected org.springframework.amqp.core.AmqpAdmin getAdmin() -
getConnectionFactory
protected org.springframework.amqp.rabbit.connection.ConnectionFactory getConnectionFactory() -
onInit
protected void onInit()- Overrides:
onInit
in classorg.springframework.integration.channel.AbstractMessageChannel
-
destroy
public void destroy()- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Specified by:
destroy
in interfaceorg.springframework.integration.support.management.IntegrationManagement
- Overrides:
destroy
in classorg.springframework.integration.channel.AbstractMessageChannel
-
doSend
protected boolean doSend(org.springframework.messaging.Message<?> message, long timeout)- Specified by:
doSend
in classorg.springframework.integration.channel.AbstractMessageChannel
-
onCreate
public void onCreate(org.springframework.amqp.rabbit.connection.Connection connection)- Specified by:
onCreate
in interfaceorg.springframework.amqp.rabbit.connection.ConnectionListener
-
onClose
public void onClose(org.springframework.amqp.rabbit.connection.Connection connection)- Specified by:
onClose
in interfaceorg.springframework.amqp.rabbit.connection.ConnectionListener
-
doDeclares
protected abstract void doDeclares()
-