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 Summary
Nested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannel
AbstractMessageChannel.ChannelInterceptorListNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class org.springframework.integration.channel.AbstractMessageChannel
interceptors, metersFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.messaging.MessageChannel
INDEFINITE_TIMEOUT -
Method Summary
Modifier 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.voidonClose(Connection connection) 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 afterwards.voidsetLoggingEnabled(boolean loggingEnabled) Enable logging or not.Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
addInterceptor, 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.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
onFailed, onShutDownMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getManagedName, getManagedType, getThisAs, setManagedName, setManagedTypeMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName, getComponentName
-
Method Details
-
isLoggingEnabled
public boolean isLoggingEnabled()Description copied from interface:IntegrationManagementReturn whether logging is enabled.- Specified by:
isLoggingEnabledin interfaceIntegrationManagement- Overrides:
isLoggingEnabledin classAbstractMessageChannel- Returns:
- true if enabled.
-
setLoggingEnabled
public void setLoggingEnabled(boolean loggingEnabled) Description copied from interface:IntegrationManagementEnable logging or not.- Specified by:
setLoggingEnabledin interfaceIntegrationManagement- Overrides:
setLoggingEnabledin classAbstractMessageChannel- Parameters:
loggingEnabled- false to disable.
-
setDefaultDeliveryMode
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:
-
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
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
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
-
getRabbitTemplate
-
setAdmin
-
setConnectionFactory
-
getAdmin
-
getConnectionFactory
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
onInitin classAbstractMessageChannel
-
destroy
public void destroy()- Specified by:
destroyin interfaceDisposableBean- Specified by:
destroyin interfaceIntegrationManagement- Overrides:
destroyin classAbstractMessageChannel
-
doSend
Description 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 classAbstractMessageChannel- Parameters:
message- The message.timeout- The timeout.- Returns:
- true if the
sendwas successful.
-
onCreate
- Specified by:
onCreatein interfaceConnectionListener
-
onClose
- Specified by:
onClosein interfaceConnectionListener
-
doDeclares
protected abstract void doDeclares()
-