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
- Since:
- 2.1
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.springframework.integration.channel.AbstractMessageChannel
interceptors, metersFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger -
Method Summary
Modifier and Type Method Description voiddestroy()protected abstract voiddoDeclares()protected booleandoSend(org.springframework.messaging.Message<?> message, long timeout)protected org.springframework.amqp.core.AmqpAdmingetAdmin()protected org.springframework.amqp.core.AmqpTemplategetAmqpTemplate()protected org.springframework.amqp.rabbit.connection.ConnectionFactorygetConnectionFactory()protected java.lang.StringgetExchangeName()Subclasses may override this method to return an Exchange name.protected AmqpHeaderMappergetInboundHeaderMapper()protected org.springframework.amqp.rabbit.core.RabbitTemplategetRabbitTemplate()protected java.lang.StringgetRoutingKey()Subclasses may override this method to return a routing key.protected booleanisExtractPayload()booleanisLoggingEnabled()voidonClose(org.springframework.amqp.rabbit.connection.Connection connection)voidonCreate(org.springframework.amqp.rabbit.connection.Connection connection)protected voidonInit()protected voidsetAdmin(org.springframework.amqp.core.AmqpAdmin admin)protected voidsetConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)voidsetDefaultDeliveryMode(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.voidsetExtractPayload(boolean extractPayload)Set to true to extract the payload and map the headers; otherwise the entire message is converted and sent.voidsetHeadersMappedLast(boolean headersMappedLast)When mapping headers for the outbound message, determine whether the headers are mapped before the message is converted, or afterwards.voidsetLoggingEnabled(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, setShouldTrackMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.amqp.rabbit.connection.ConnectionListener
onShutDown
-
Method Details
-
isLoggingEnabled
public boolean isLoggingEnabled()- Specified by:
isLoggingEnabledin interfaceorg.springframework.integration.support.management.IntegrationManagement- Overrides:
isLoggingEnabledin classorg.springframework.integration.channel.AbstractMessageChannel
-
setLoggingEnabled
public void setLoggingEnabled(boolean loggingEnabled)- Specified by:
setLoggingEnabledin interfaceorg.springframework.integration.support.management.IntegrationManagement- Overrides:
setLoggingEnabledin 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 aSimpleMessageConverterwith a String payload that contains json; the converter will set the content type totext/plainwhich can be overridden toapplication/jsonby setting theAmqpHeaders.CONTENT_TYPEmessage header. Only applies whenextractPayloadis 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:
onInitin classorg.springframework.integration.channel.AbstractMessageChannel
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Specified by:
destroyin interfaceorg.springframework.integration.support.management.IntegrationManagement- Overrides:
destroyin classorg.springframework.integration.channel.AbstractMessageChannel
-
doSend
protected boolean doSend(org.springframework.messaging.Message<?> message, long timeout)- Specified by:
doSendin classorg.springframework.integration.channel.AbstractMessageChannel
-
onCreate
public void onCreate(org.springframework.amqp.rabbit.connection.Connection connection)- Specified by:
onCreatein interfaceorg.springframework.amqp.rabbit.connection.ConnectionListener
-
onClose
public void onClose(org.springframework.amqp.rabbit.connection.Connection connection)- Specified by:
onClosein interfaceorg.springframework.amqp.rabbit.connection.ConnectionListener
-
doDeclares
protected abstract void doDeclares()
-