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
FieldsModifier and TypeFieldDescriptionprivate ConsumerCancelledExceptionprivate final BlockingQueue<Delivery> private ShutdownSignalExceptionprivate static final Delivery -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionprivate voidCheck if we are in shutdown mode and if so throw an exception.private DeliveryIf delivery is not POISON nor null, return it.voidhandleCancel(String consumerTag) No-op implementation ofConsumer.handleCancel(String)voidhandleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) voidhandleShutdownSignal(String consumerTag, ShutdownSignalException sig) No-op implementation ofConsumer.handleShutdownSignal(java.lang.String, com.rabbitmq.client.ShutdownSignalException).Methods inherited from class com.rabbitmq.client.DefaultConsumer
getChannel, getConsumerTag, handleCancelOk, handleConsumeOk, handleRecoverOkMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.rabbitmq.client.Consumer
handleCancelOk, handleConsumeOk, handleRecoverOkMethods inherited from interface com.rabbitmq.client.RpcServer.RpcConsumer
getConsumerTag
-
Field Details
-
POISON
-
_queue
-
_shutdown
-
_cancelled
-
-
Constructor Details
-
DefaultRpcConsumer
-
DefaultRpcConsumer
-
-
Method Details
-
nextDelivery
public Delivery nextDelivery() throws InterruptedException, ShutdownSignalException, ConsumerCancelledException- Specified by:
nextDeliveryin interfaceRpcServer.RpcConsumer- Throws:
InterruptedExceptionShutdownSignalExceptionConsumerCancelledException
-
handleShutdownSignal
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
Description 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:
IOException
-
handleDelivery
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException Description 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:
IOException- if the consumer encounters an I/O error while processing the message- See Also:
-
checkShutdown
private void checkShutdown()Check if we are in shutdown mode and if so throw an exception. -
handle
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.
-