public class BlockingQueueConsumer extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
BlockingQueueConsumer.DeclarationException |
| Constructor and Description |
|---|
BlockingQueueConsumer(ConnectionFactory connectionFactory,
MessagePropertiesConverter messagePropertiesConverter,
ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter,
AcknowledgeMode acknowledgeMode,
boolean transactional,
int prefetchCount,
boolean defaultRequeueRejected,
Map<String,Object> consumerArgs,
boolean exclusive,
String... queues)
Create a consumer.
|
BlockingQueueConsumer(ConnectionFactory connectionFactory,
MessagePropertiesConverter messagePropertiesConverter,
ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter,
AcknowledgeMode acknowledgeMode,
boolean transactional,
int prefetchCount,
boolean defaultRequeueRejected,
Map<String,Object> consumerArgs,
String... queues)
Create a consumer.
|
BlockingQueueConsumer(ConnectionFactory connectionFactory,
MessagePropertiesConverter messagePropertiesConverter,
ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter,
AcknowledgeMode acknowledgeMode,
boolean transactional,
int prefetchCount,
boolean defaultRequeueRejected,
String... queues)
Create a consumer.
|
BlockingQueueConsumer(ConnectionFactory connectionFactory,
MessagePropertiesConverter messagePropertiesConverter,
ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter,
AcknowledgeMode acknowledgeMode,
boolean transactional,
int prefetchCount,
String... queues)
Create a consumer.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
basicCancel() |
boolean |
commitIfNecessary(boolean locallyTransacted)
Perform a commit or message acknowledgement, as appropriate.
|
com.rabbitmq.client.Channel |
getChannel() |
String |
getConsumerTag() |
protected boolean |
hasDelivery() |
Message |
nextMessage()
Main application-side API: wait for the next message delivery and return it.
|
Message |
nextMessage(long timeout)
Main application-side API: wait for the next message delivery and return it.
|
void |
rollbackOnExceptionIfNecessary(Throwable ex)
Perform a rollback, handling rollback exceptions properly.
|
void |
setQuiesce(long shutdownTimeout)
Deprecated.
as redundant option in favor of
basicCancel(). |
void |
start() |
void |
stop() |
String |
toString() |
public BlockingQueueConsumer(ConnectionFactory connectionFactory, MessagePropertiesConverter messagePropertiesConverter, ActiveObjectCounter<BlockingQueueConsumer> activeObjectCounter, AcknowledgeMode acknowledgeMode, boolean transactional, int prefetchCount, 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, AcknowledgeMode acknowledgeMode, boolean transactional, int prefetchCount, boolean defaultRequeueRejected, 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, AcknowledgeMode acknowledgeMode, boolean transactional, int prefetchCount, boolean defaultRequeueRejected, Map<String,Object> consumerArgs, 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, AcknowledgeMode acknowledgeMode, boolean transactional, int prefetchCount, boolean defaultRequeueRejected, Map<String,Object> consumerArgs, boolean exclusive, 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 String getConsumerTag()
@Deprecated public final void setQuiesce(long shutdownTimeout)
basicCancel().shutdownTimeout - how long (ms) to suspend the client thread.protected void basicCancel()
protected boolean hasDelivery()
public Message nextMessage() throws InterruptedException, com.rabbitmq.client.ShutdownSignalException
InterruptedException - if an interrupt is received while waitingcom.rabbitmq.client.ShutdownSignalException - if the connection is shut down while waitingpublic Message nextMessage(long timeout) throws InterruptedException, com.rabbitmq.client.ShutdownSignalException
timeout - timeout in millisecondInterruptedException - if an interrupt is received while waitingcom.rabbitmq.client.ShutdownSignalException - if the connection is shut down while waitingpublic void start()
throws AmqpException
AmqpExceptionpublic void stop()
public void rollbackOnExceptionIfNecessary(Throwable ex) throws Exception
ex - the thrown application exception or errorException - in case of a rollback errorpublic boolean commitIfNecessary(boolean locallyTransacted)
throws IOException
locallyTransacted - Whether the channel is locally transacted.IOException - Any IOException.