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 ConsumerCancelledException
private final BlockingQueue
<Delivery> private ShutdownSignalException
private static final Delivery
-
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Check if we are in shutdown mode and if so throw an exception.private Delivery
If delivery is not POISON nor null, return it.void
handleCancel
(String consumerTag) No-op implementation ofConsumer.handleCancel(String)
void
handleDelivery
(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) void
handleShutdownSignal
(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, 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 Details
-
POISON
-
_queue
-
_shutdown
-
_cancelled
-
-
Constructor Details
-
DefaultRpcConsumer
-
DefaultRpcConsumer
-
-
Method Details
-
nextDelivery
public Delivery nextDelivery() throws InterruptedException, ShutdownSignalException, ConsumerCancelledException- Specified by:
nextDelivery
in interfaceRpcServer.RpcConsumer
- Throws:
InterruptedException
ShutdownSignalException
ConsumerCancelledException
-
handleShutdownSignal
Description copied from class:DefaultConsumer
No-op implementation ofConsumer.handleShutdownSignal(java.lang.String, com.rabbitmq.client.ShutdownSignalException)
.- Specified by:
handleShutdownSignal
in interfaceConsumer
- Overrides:
handleShutdownSignal
in classDefaultConsumer
- Parameters:
consumerTag
- the consumer tag associated with the consumersig
- aShutdownSignalException
indicating the reason for the shut down
-
handleCancel
Description copied from class:DefaultConsumer
No-op implementation ofConsumer.handleCancel(String)
- Specified by:
handleCancel
in interfaceConsumer
- Overrides:
handleCancel
in 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:DefaultConsumer
No-op implementation ofConsumer.handleDelivery(java.lang.String, com.rabbitmq.client.Envelope, com.rabbitmq.client.AMQP.BasicProperties, byte[])
.- Specified by:
handleDelivery
in interfaceConsumer
- Overrides:
handleDelivery
in 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.
-