Package com.rabbitmq.client
Class RpcServer.DefaultRpcConsumer
- java.lang.Object
-
- com.rabbitmq.client.DefaultConsumer
-
- com.rabbitmq.client.RpcServer.DefaultRpcConsumer
-
- All Implemented Interfaces:
Consumer,RpcServer.RpcConsumer
- Enclosing class:
- RpcServer
private static class RpcServer.DefaultRpcConsumer extends DefaultConsumer implements RpcServer.RpcConsumer
-
-
Field Summary
Fields Modifier and Type Field Description private ConsumerCancelledException_cancelledprivate java.util.concurrent.BlockingQueue<Delivery>_queueprivate ShutdownSignalException_shutdownprivate static DeliveryPOISON
-
Constructor Summary
Constructors Constructor Description DefaultRpcConsumer(Channel ch)DefaultRpcConsumer(Channel ch, java.util.concurrent.BlockingQueue<Delivery> q)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckShutdown()Check if we are in shutdown mode and if so throw an exception.private Deliveryhandle(Delivery delivery)If delivery is not POISON nor null, return it.voidhandleCancel(java.lang.String consumerTag)No-op implementation ofConsumer.handleCancel(String)voidhandleDelivery(java.lang.String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)voidhandleShutdownSignal(java.lang.String consumerTag, ShutdownSignalException sig)No-op implementation ofConsumer.handleShutdownSignal(java.lang.String, com.rabbitmq.client.ShutdownSignalException).DeliverynextDelivery()-
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
-
Methods inherited from interface com.rabbitmq.client.Consumer
handleCancelOk, handleConsumeOk, handleRecoverOk
-
Methods inherited from interface com.rabbitmq.client.RpcServer.RpcConsumer
getConsumerTag
-
-
-
-
Field Detail
-
POISON
private static final Delivery POISON
-
_queue
private final java.util.concurrent.BlockingQueue<Delivery> _queue
-
_shutdown
private volatile ShutdownSignalException _shutdown
-
_cancelled
private volatile ConsumerCancelledException _cancelled
-
-
Method Detail
-
nextDelivery
public Delivery nextDelivery() throws java.lang.InterruptedException, ShutdownSignalException, ConsumerCancelledException
- Specified by:
nextDeliveryin interfaceRpcServer.RpcConsumer- Throws:
java.lang.InterruptedExceptionShutdownSignalExceptionConsumerCancelledException
-
handleShutdownSignal
public void handleShutdownSignal(java.lang.String consumerTag, ShutdownSignalException sig)Description copied from class:DefaultConsumerNo-op implementation ofConsumer.handleShutdownSignal(java.lang.String, com.rabbitmq.client.ShutdownSignalException).- Specified by:
handleShutdownSignalin interfaceConsumer- Overrides:
handleShutdownSignalin classDefaultConsumer- Parameters:
consumerTag- the consumer tag associated with the consumersig- aShutdownSignalExceptionindicating the reason for the shut down
-
handleCancel
public void handleCancel(java.lang.String consumerTag) throws java.io.IOExceptionDescription copied from class:DefaultConsumerNo-op implementation ofConsumer.handleCancel(String)- Specified by:
handleCancelin interfaceConsumer- Overrides:
handleCancelin classDefaultConsumer- Parameters:
consumerTag- the defined consumer tag (client- or server-generated)- Throws:
java.io.IOException
-
handleDelivery
public void handleDelivery(java.lang.String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws java.io.IOExceptionDescription copied from class:DefaultConsumerNo-op implementation ofConsumer.handleDelivery(java.lang.String, com.rabbitmq.client.Envelope, com.rabbitmq.client.AMQP.BasicProperties, byte[]).- Specified by:
handleDeliveryin interfaceConsumer- Overrides:
handleDeliveryin classDefaultConsumer- Parameters:
consumerTag- the consumer tag associated with the consumerenvelope- packaging data for the messageproperties- content header data for the messagebody- the message body (opaque, client-specific byte array)- Throws:
java.io.IOException- if the consumer encounters an I/O error while processing the message- See Also:
Envelope
-
checkShutdown
private void checkShutdown()
Check if we are in shutdown mode and if so throw an exception.
-
handle
private Delivery handle(Delivery delivery)
If delivery is not POISON nor null, return it. If delivery, _shutdown and _cancelled are all null, return null. If delivery is POISON re-insert POISON into the queue and throw an exception if POISONed for no reason. Otherwise, if we are in shutdown mode or cancelled, throw a corresponding exception.
-
-