public class BlockingQueueConsumer
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
BlockingQueueConsumer.DeclarationException |
| Constructor and Description |
|---|
BlockingQueueConsumer(ConnectionFactory connectionFactory,
MessagePropertiesConverter messagePropertiesConverter,
ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter,
org.springframework.amqp.core.AcknowledgeMode acknowledgeMode,
boolean transactional,
int prefetchCount,
boolean defaultRequeueRejected,
java.util.Map<java.lang.String,java.lang.Object> consumerArgs,
boolean exclusive,
java.lang.String... queues)
Create a consumer.
|
BlockingQueueConsumer(ConnectionFactory connectionFactory,
MessagePropertiesConverter messagePropertiesConverter,
ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter,
org.springframework.amqp.core.AcknowledgeMode acknowledgeMode,
boolean transactional,
int prefetchCount,
boolean defaultRequeueRejected,
java.util.Map<java.lang.String,java.lang.Object> consumerArgs,
java.lang.String... queues)
Create a consumer.
|
BlockingQueueConsumer(ConnectionFactory connectionFactory,
MessagePropertiesConverter messagePropertiesConverter,
ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter,
org.springframework.amqp.core.AcknowledgeMode acknowledgeMode,
boolean transactional,
int prefetchCount,
boolean defaultRequeueRejected,
java.lang.String... queues)
Create a consumer.
|
BlockingQueueConsumer(ConnectionFactory connectionFactory,
MessagePropertiesConverter messagePropertiesConverter,
ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter,
org.springframework.amqp.core.AcknowledgeMode acknowledgeMode,
boolean transactional,
int prefetchCount,
java.lang.String... queues)
Create a consumer.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
commitIfNecessary(boolean locallyTransacted)
Perform a commit or message acknowledgement, as appropriate.
|
com.rabbitmq.client.Channel |
getChannel() |
java.lang.String |
getConsumerTag() |
org.springframework.amqp.core.Message |
nextMessage()
Main application-side API: wait for the next message delivery and return it.
|
org.springframework.amqp.core.Message |
nextMessage(long timeout)
Main application-side API: wait for the next message delivery and return it.
|
void |
rollbackOnExceptionIfNecessary(java.lang.Throwable ex)
Perform a rollback, handling rollback exceptions properly.
|
void |
setQuiesce(long shutdownTimeout)
Stop receiving new messages; drain the queue of any prefetched messages.
|
void |
start() |
void |
stop() |
java.lang.String |
toString() |
public BlockingQueueConsumer(ConnectionFactory connectionFactory, MessagePropertiesConverter messagePropertiesConverter, ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter, org.springframework.amqp.core.AcknowledgeMode acknowledgeMode, boolean transactional, int prefetchCount, java.lang.String... queues)
connectionFactory - The connection factory.messagePropertiesConverter - The properties converter.activeObjectCounter - The active object counter; used during shutdown.acknowledgeMode - The acknowledgemode.transactional - Whether the channel is transactional.prefetchCount - The prefetch count.queues - The queues.public BlockingQueueConsumer(ConnectionFactory connectionFactory, MessagePropertiesConverter messagePropertiesConverter, ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter, org.springframework.amqp.core.AcknowledgeMode acknowledgeMode, boolean transactional, int prefetchCount, boolean defaultRequeueRejected, java.lang.String... queues)
connectionFactory - The connection factory.messagePropertiesConverter - The properties converter.activeObjectCounter - The active object counter; used during shutdown.acknowledgeMode - The acknowledge mode.transactional - Whether the channel is transactional.prefetchCount - The prefetch count.defaultRequeueRejected - true to reject requeued messages.queues - The queues.public BlockingQueueConsumer(ConnectionFactory connectionFactory, MessagePropertiesConverter messagePropertiesConverter, ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter, org.springframework.amqp.core.AcknowledgeMode acknowledgeMode, boolean transactional, int prefetchCount, boolean defaultRequeueRejected, java.util.Map<java.lang.String,java.lang.Object> consumerArgs, java.lang.String... queues)
connectionFactory - The connection factory.messagePropertiesConverter - The properties converter.activeObjectCounter - The active object counter; used during shutdown.acknowledgeMode - The acknowledge mode.transactional - Whether the channel is transactional.prefetchCount - The prefetch count.defaultRequeueRejected - true to reject requeued messages.consumerArgs - The consumer arguments (e.g. x-priority).queues - The queues.public BlockingQueueConsumer(ConnectionFactory connectionFactory, MessagePropertiesConverter messagePropertiesConverter, ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter, org.springframework.amqp.core.AcknowledgeMode acknowledgeMode, boolean transactional, int prefetchCount, boolean defaultRequeueRejected, java.util.Map<java.lang.String,java.lang.Object> consumerArgs, boolean exclusive, java.lang.String... queues)
connectionFactory - The connection factory.messagePropertiesConverter - The properties converter.activeObjectCounter - The active object counter; used during shutdown.acknowledgeMode - The acknowledge mode.transactional - Whether the channel is transactional.prefetchCount - The prefetch count.defaultRequeueRejected - true to reject requeued messages.consumerArgs - The consumer arguments (e.g. x-priority).exclusive - true if the consumer is to be exclusive.queues - The queues.public com.rabbitmq.client.Channel getChannel()
public java.lang.String getConsumerTag()
public final void setQuiesce(long shutdownTimeout)
shutdownTimeout - how long (ms) to suspend the client thread.public org.springframework.amqp.core.Message nextMessage()
throws java.lang.InterruptedException,
com.rabbitmq.client.ShutdownSignalException
java.lang.InterruptedException - if an interrupt is received while waitingcom.rabbitmq.client.ShutdownSignalException - if the connection is shut down while waitingpublic org.springframework.amqp.core.Message nextMessage(long timeout)
throws java.lang.InterruptedException,
com.rabbitmq.client.ShutdownSignalException
timeout - timeout in millisecondjava.lang.InterruptedException - if an interrupt is received while waitingcom.rabbitmq.client.ShutdownSignalException - if the connection is shut down while waitingpublic void start()
throws org.springframework.amqp.AmqpException
org.springframework.amqp.AmqpExceptionpublic void stop()
public java.lang.String toString()
toString in class java.lang.Objectpublic void rollbackOnExceptionIfNecessary(java.lang.Throwable ex)
throws java.lang.Exception
ex - the thrown application exception or errorjava.lang.Exception - in case of a rollback errorpublic boolean commitIfNecessary(boolean locallyTransacted)
throws java.io.IOException
locallyTransacted - Whether the channel is locally transacted.java.io.IOException - Any IOException.