org.springframework.amqp.rabbit.listener
Class BlockingQueueConsumer
java.lang.Object
org.springframework.amqp.rabbit.listener.BlockingQueueConsumer
public class BlockingQueueConsumer
- extends Object
Variation on QueueingConsumer in RabbitMQ, uses 'put' instead of 'add' and stored a reference to the consumerTag that
was returned when this Consumer was registered with the channel so as to make it easy to close the consumer when
shutting down.
- Author:
- Mark Pollack, Dave Syer
BlockingQueueConsumer
public BlockingQueueConsumer(com.rabbitmq.client.Channel channel,
AcknowledgeMode acknowledgeMode,
boolean transactional,
int prefetchCount,
String... queues)
getChannel
public com.rabbitmq.client.Channel getChannel()
getConsumerTag
public String getConsumerTag()
nextMessage
public Message nextMessage()
throws InterruptedException,
com.rabbitmq.client.ShutdownSignalException
- Main application-side API: wait for the next message delivery and return it.
- Returns:
- the next message
- Throws:
InterruptedException
- if an interrupt is received while waiting
com.rabbitmq.client.ShutdownSignalException
- if the connection is shut down while waiting
nextMessage
public Message nextMessage(long timeout)
throws InterruptedException,
com.rabbitmq.client.ShutdownSignalException
- Main application-side API: wait for the next message delivery and return it.
- Parameters:
timeout
- timeout in millisecond
- Returns:
- the next message or null if timed out
- Throws:
InterruptedException
- if an interrupt is received while waiting
com.rabbitmq.client.ShutdownSignalException
- if the connection is shut down while waiting
start
public void start()
throws AmqpException
- Throws:
AmqpException
stop
public void stop()
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2011. All Rights Reserved.