public class PollableAmqpChannel extends AbstractAmqpChannel implements PollableChannel, ExecutorChannelInterceptorAware
PollableChannel
implementation that is backed by an AMQP Queue.
Messages will be sent to the default (no-name) exchange with that Queue's
name as the routing key.AbstractMessageChannel.ChannelInterceptorList
IntegrationManagement.ManagementOverrides
interceptors, meters
EXPRESSION_PARSER, logger
INDEFINITE_TIMEOUT
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
PollableAmqpChannel(String channelName,
AmqpTemplate amqpTemplate)
Construct an instance with the supplied name, template and default header mappers
used if the template is a
RabbitTemplate and the message is mapped. |
PollableAmqpChannel(String channelName,
AmqpTemplate amqpTemplate,
AmqpHeaderMapper outboundMapper,
AmqpHeaderMapper inboundMapper)
Construct an instance with the supplied name, template and header mappers.
|
Modifier and Type | Method and Description |
---|---|
void |
addInterceptor(ChannelInterceptor interceptor)
Add a channel interceptor to the end of the list.
|
void |
addInterceptor(int index,
ChannelInterceptor interceptor)
Add a channel interceptor to the specified index of the list.
|
protected void |
doDeclares() |
protected Message<?> |
doReceive(Long timeout) |
protected String |
getRoutingKey()
Subclasses may override this method to return a routing key.
|
boolean |
hasExecutorInterceptors() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected Object |
performReceive(Long timeout) |
Message<?> |
receive() |
Message<?> |
receive(long timeout) |
boolean |
removeInterceptor(ChannelInterceptor interceptor) |
ChannelInterceptor |
removeInterceptor(int index) |
void |
setAmqpAdmin(AmqpAdmin amqpAdmin)
Provide an instance of AmqpAdmin for implicitly declaring Queues if the queueName is not provided.
|
void |
setInterceptors(List<ChannelInterceptor> interceptors)
Set the list of channel interceptors.
|
void |
setQueueName(String queueName)
Provide an explicitly configured queue name.
|
destroy, doSend, getAdmin, getAmqpTemplate, getConnectionFactory, getExchangeName, getInboundHeaderMapper, getRabbitTemplate, isExtractPayload, isLoggingEnabled, onClose, onCreate, setAdmin, setConnectionFactory, setDefaultDeliveryMode, setExtractPayload, setHeadersMappedLast, setLoggingEnabled
getComponentType, getFullChannelName, getIChannelInterceptorList, getIntegrationPatternType, getInterceptors, getMetricsCaptor, getOverrides, registerMetricsCaptor, send, send, setDatatypes, setMessageConverter, setShouldTrack
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
send, send
getInterceptors
onShutDown
getManagedName, getManagedType, getThisAs, setManagedName, setManagedType
getBeanName, getComponentName
public PollableAmqpChannel(String channelName, AmqpTemplate amqpTemplate)
RabbitTemplate
and the message is mapped.channelName
- the channel name.amqpTemplate
- the template.AbstractAmqpChannel.setExtractPayload(boolean)
public PollableAmqpChannel(String channelName, AmqpTemplate amqpTemplate, AmqpHeaderMapper outboundMapper, AmqpHeaderMapper inboundMapper)
channelName
- the channel name.amqpTemplate
- the template.outboundMapper
- the outbound mapper.inboundMapper
- the inbound mapper.AbstractAmqpChannel.setExtractPayload(boolean)
public void setQueueName(String queueName)
queueName
- The queue name.public void setAmqpAdmin(AmqpAdmin amqpAdmin)
amqpAdmin
- The amqp admin.protected String getRoutingKey()
AbstractAmqpChannel
getRoutingKey
in class AbstractAmqpChannel
protected void onInit()
IntegrationObjectSupport
onInit
in class AbstractAmqpChannel
protected void doDeclares()
doDeclares
in class AbstractAmqpChannel
@Nullable public Message<?> receive()
receive
in interface PollableChannel
@Nullable public Message<?> receive(long timeout)
receive
in interface PollableChannel
public void setInterceptors(List<ChannelInterceptor> interceptors)
AbstractMessageChannel
setInterceptors
in interface InterceptableChannel
setInterceptors
in class AbstractMessageChannel
interceptors
- The list of interceptors.public void addInterceptor(ChannelInterceptor interceptor)
AbstractMessageChannel
addInterceptor
in interface InterceptableChannel
addInterceptor
in class AbstractMessageChannel
interceptor
- The interceptor.public void addInterceptor(int index, ChannelInterceptor interceptor)
AbstractMessageChannel
addInterceptor
in interface InterceptableChannel
addInterceptor
in class AbstractMessageChannel
index
- The index to add interceptor.interceptor
- The interceptor.public boolean removeInterceptor(ChannelInterceptor interceptor)
removeInterceptor
in interface InterceptableChannel
removeInterceptor
in class AbstractMessageChannel
@Nullable public ChannelInterceptor removeInterceptor(int index)
removeInterceptor
in interface InterceptableChannel
removeInterceptor
in class AbstractMessageChannel
public boolean hasExecutorInterceptors()
hasExecutorInterceptors
in interface ExecutorChannelInterceptorAware