org.springframework.amqp.rabbit.listener
Class BlockingQueueConsumer
java.lang.Object
com.rabbitmq.client.DefaultConsumer
org.springframework.amqp.rabbit.listener.BlockingQueueConsumer
- All Implemented Interfaces:
- com.rabbitmq.client.Consumer
public class BlockingQueueConsumer
- extends com.rabbitmq.client.DefaultConsumer
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
Methods inherited from class com.rabbitmq.client.DefaultConsumer |
getChannel, getConsumerTag, handleCancelOk, handleConsumeOk, handleRecoverOk |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BlockingQueueConsumer
public BlockingQueueConsumer(com.rabbitmq.client.Channel ch)
BlockingQueueConsumer
public BlockingQueueConsumer(com.rabbitmq.client.Channel ch,
BlockingQueue<BlockingQueueConsumer.Delivery> q)
handleShutdownSignal
public void handleShutdownSignal(String consumerTag,
com.rabbitmq.client.ShutdownSignalException sig)
- Specified by:
handleShutdownSignal
in interface com.rabbitmq.client.Consumer
- Overrides:
handleShutdownSignal
in class com.rabbitmq.client.DefaultConsumer
handleDelivery
public void handleDelivery(String consumerTag,
com.rabbitmq.client.Envelope envelope,
com.rabbitmq.client.AMQP.BasicProperties properties,
byte[] body)
throws IOException
- Specified by:
handleDelivery
in interface com.rabbitmq.client.Consumer
- Overrides:
handleDelivery
in class com.rabbitmq.client.DefaultConsumer
- Throws:
IOException
nextDelivery
public BlockingQueueConsumer.Delivery nextDelivery()
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
nextDelivery
public BlockingQueueConsumer.Delivery nextDelivery(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
Copyright © 2010. All Rights Reserved.