Class AbstractAmqpChannel
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.channel.AbstractMessageChannel
org.springframework.integration.amqp.channel.AbstractAmqpChannel
- All Implemented Interfaces:
- ConnectionListener,- Aware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- ExpressionCapable,- IntegrationPattern,- NamedComponent,- IntegrationManagement,- TrackableComponent,- MessageChannel,- InterceptableChannel
- Direct Known Subclasses:
- PointToPointSubscribableAmqpChannel,- PollableAmqpChannel,- PublishSubscribeAmqpChannel
public abstract class AbstractAmqpChannel
extends AbstractMessageChannel
implements ConnectionListener
The base 
AbstractMessageChannel implementation for AMQP.- Since:
- 2.1
- Author:
- Mark Fisher, Artem Bilan, Gary Russell
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannelAbstractMessageChannel.ChannelInterceptorListNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.channel.AbstractMessageChannelinterceptors, metersFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.messaging.MessageChannelINDEFINITE_TIMEOUT
- 
Method SummaryModifier and TypeMethodDescriptionvoiddestroy()protected abstract voidprotected booleanSubclasses must implement this method.protected AmqpAdmingetAdmin()protected AmqpTemplateprotected ConnectionFactoryprotected StringSubclasses may override this method to return an Exchange name.protected AmqpHeaderMapperprotected RabbitTemplateprotected StringSubclasses may override this method to return a routing key.protected booleanbooleanReturn whether logging is enabled.voidonCreate(Connection connection) protected voidonInit()Subclasses may implement this for initialization logic.protected final voidprotected final voidsetConnectionFactory(ConnectionFactory connectionFactory) voidsetDefaultDeliveryMode(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 afterward.voidsetLoggingEnabled(boolean loggingEnabled) Enable logging or not.Methods inherited from class org.springframework.integration.channel.AbstractMessageChanneladdInterceptor, addInterceptor, getComponentType, getFullChannelName, getIChannelInterceptorList, getIntegrationPatternType, getInterceptors, getMetricsCaptor, getOverrides, isObserved, registerMetricsCaptor, registerObservationRegistry, removeInterceptor, removeInterceptor, send, send, setDatatypes, setInterceptors, setMessageConverter, setObservationConvention, setShouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.amqp.rabbit.connection.ConnectionListeneronClose, onFailed, onShutDownMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetManagedName, getManagedType, getThisAs, setManagedName, setManagedTypeMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Method Details- 
isLoggingEnabledpublic boolean isLoggingEnabled()Description copied from interface:IntegrationManagementReturn whether logging is enabled.- Specified by:
- isLoggingEnabledin interface- IntegrationManagement
- Overrides:
- isLoggingEnabledin class- AbstractMessageChannel
- Returns:
- true if enabled.
 
- 
setLoggingEnabledpublic void setLoggingEnabled(boolean loggingEnabled) Description copied from interface:IntegrationManagementEnable logging or not.- Specified by:
- setLoggingEnabledin interface- IntegrationManagement
- Overrides:
- setLoggingEnabledin class- AbstractMessageChannel
- Parameters:
- loggingEnabled- false to disable.
 
- 
setDefaultDeliveryModeSet 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
 
- 
setExtractPayloadpublic 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
 
- 
isExtractPayloadprotected boolean isExtractPayload()- Returns:
- the extract payload.
- Since:
- 4.3
- See Also:
 
- 
setHeadersMappedLastpublic void setHeadersMappedLast(boolean headersMappedLast) When mapping headers for the outbound message, determine whether the headers are mapped before the message is converted, or afterward. 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
 
- 
getExchangeNameSubclasses 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.
 
- 
getRoutingKeySubclasses 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
- 
getRabbitTemplate
- 
setAdmin
- 
setConnectionFactory
- 
getAdmin
- 
getConnectionFactory
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- AbstractMessageChannel
 
- 
destroypublic void destroy()- Specified by:
- destroyin interface- DisposableBean
- Specified by:
- destroyin interface- IntegrationManagement
- Overrides:
- destroyin class- AbstractMessageChannel
 
- 
doSendDescription copied from class:AbstractMessageChannelSubclasses must implement this method. A non-negative timeout indicates how long to wait if the channel is at capacity (if the value is 0, it must return immediately with or without success). A negative timeout value indicates that the method should block until either the message is accepted or the blocking thread is interrupted.- Specified by:
- doSendin class- AbstractMessageChannel
- Parameters:
- message- The message.
- timeout- The timeout.
- Returns:
- true if the sendwas successful.
 
- 
onCreate- Specified by:
- onCreatein interface- ConnectionListener
 
- 
doDeclaresprotected abstract void doDeclares()
 
-