|
Spring AMQP | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.amqp.rabbit.support.RabbitAccessor
org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer
org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
public class SimpleMessageListenerContainer
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer |
---|
AbstractRabbitListeningContainer.SharedConnectionNotInitializedException |
Field Summary | |
---|---|
static long |
DEFAULT_RECEIVE_TIMEOUT
|
Fields inherited from class org.springframework.amqp.rabbit.support.RabbitAccessor |
---|
logger |
Constructor Summary | |
---|---|
SimpleMessageListenerContainer()
|
|
SimpleMessageListenerContainer(ConnectionFactory connectionFactory)
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Avoid the possibility of not configuring the CachingConnectionFactory in sync with the number of concurrent consumers. |
protected BlockingQueueConsumer |
createBlockingQueueConsumer(com.rabbitmq.client.Channel channel)
|
protected void |
doInitialize()
Creates the specified number of concurrent consumers, in the form of a Rabbit Channel plus associated MessageConsumer. |
protected void |
doShutdown()
Close the registered invokers. |
protected void |
doStart()
Re-initializes this container's Rabbit message consumers, if not initialized already. |
protected void |
doStop()
Notify all invoker tasks and stop the shared Connection, if any. |
int |
getBlockingQueueConsumerCapacity()
|
int |
getPrefetchCount()
|
int |
getTxSize()
|
protected void |
initializeConsumers()
|
protected boolean |
isChannelLocallyTransacted(com.rabbitmq.client.Channel channel)
Check whether the given Channel is locally transacted, that is, whether its transaction is managed by this listener container's Channel handling and not by an external transaction coordinator. |
void |
setBlockingQueueConsumerCapacity(int blockingQueueConsumerCapacity)
|
void |
setConcurrentConsumers(int concurrentConsumers)
Specify the number of concurrent consumers to create. |
void |
setPrefetchCount(int prefetchCount)
|
void |
setReceiveTimeout(long receiveTimeout)
|
void |
setTaskExecutor(Executor taskExecutor)
|
void |
setTransactionManager(PlatformTransactionManager transactionManager)
|
void |
setTxSize(int txSize)
|
protected boolean |
sharedConnectionEnabled()
Always use a shared Rabbit Connection. |
Methods inherited from class org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer |
---|
checkMessageListener, commitIfNecessary, doExecuteListener, doInvokeListener, doInvokeListener, executeListener, getMessageListener, getQueueName, getRequiredQueueName, handleListenerException, invokeErrorHandler, invokeListener, isExposeListenerChannel, rollbackIfNecessary, rollbackOnExceptionIfNecessary, setErrorHandler, setExposeListenerChannel, setMessageListener, setQueueName, setQueues |
Methods inherited from class org.springframework.amqp.rabbit.listener.AbstractRabbitListeningContainer |
---|
createSharedConnection, destroy, establishSharedConnection, getBeanName, getPhase, getSharedConnection, initialize, isActive, isAutoStartup, isRunning, prepareSharedConnection, refreshSharedConnection, runningAllowed, setAutoStartup, setBeanName, setPhase, shutdown, start, stop, stop, stopSharedConnection, validateConfiguration |
Methods inherited from class org.springframework.amqp.rabbit.support.RabbitAccessor |
---|
convertRabbitAccessException, createChannel, createConnection, getChannel, getConnection, getConnectionFactory, getTransactionalResourceHolder, isChannelTransacted, setChannelTransacted, setConnectionFactory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_RECEIVE_TIMEOUT
Constructor Detail |
---|
public SimpleMessageListenerContainer()
public SimpleMessageListenerContainer(ConnectionFactory connectionFactory)
Method Detail |
---|
public void setConcurrentConsumers(int concurrentConsumers)
Raising the number of concurrent consumers is recommended in order to scale the consumption of messages coming in from a queue. However, note that any ordering guarantees are lost once multiple consumers are registered. In general, stick with 1 consumer for low-volume queues.
public void setReceiveTimeout(long receiveTimeout)
public void setTaskExecutor(Executor taskExecutor)
public int getPrefetchCount()
public void setPrefetchCount(int prefetchCount)
public int getTxSize()
public void setTxSize(int txSize)
public int getBlockingQueueConsumerCapacity()
public void setBlockingQueueConsumerCapacity(int blockingQueueConsumerCapacity)
public void setTransactionManager(PlatformTransactionManager transactionManager)
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class AbstractRabbitListeningContainer
protected final boolean sharedConnectionEnabled()
sharedConnectionEnabled
in class AbstractRabbitListeningContainer
AbstractRabbitListeningContainer.getSharedConnection()
protected void doInitialize() throws Exception
doInitialize
in class AbstractRabbitListeningContainer
Exception
AbstractRabbitListeningContainer.SharedConnectionNotInitializedException
AbstractRabbitListeningContainer.getSharedConnection()
protected void doStart() throws Exception
doStart
in class AbstractRabbitListeningContainer
Exception
AbstractRabbitListeningContainer.SharedConnectionNotInitializedException
- if thrown by Rabbit API methodsAbstractRabbitListeningContainer.establishSharedConnection()
protected void doStop()
AbstractRabbitListeningContainer
doStop
in class AbstractRabbitListeningContainer
AbstractRabbitListeningContainer.stopSharedConnection()
protected void doShutdown()
AbstractRabbitListeningContainer
Subclasses need to implement this method for their specific invoker management process.
A shared Rabbit Connection, if any, will automatically be closed afterwards.
doShutdown
in class AbstractRabbitListeningContainer
AbstractRabbitListeningContainer.shutdown()
protected void initializeConsumers() throws IOException
IOException
protected boolean isChannelLocallyTransacted(com.rabbitmq.client.Channel channel)
AbstractMessageListenerContainer
Note:This method is about finding out whether the Channel's transaction is local or externally coordinated.
isChannelLocallyTransacted
in class AbstractMessageListenerContainer
channel
- the Channel to check
RabbitAccessor.isChannelTransacted()
protected BlockingQueueConsumer createBlockingQueueConsumer(com.rabbitmq.client.Channel channel) throws IOException
IOException
|
Spring AMQP | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |