Package com.rabbitmq.client
Class DefaultConsumer
java.lang.Object
com.rabbitmq.client.DefaultConsumer
- All Implemented Interfaces:
Consumer
Convenience class providing a default implementation of
Consumer.
We anticipate that most Consumer implementations will subclass this class.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultConsumer(Channel channel) Constructs a new instance and records its association to the passed-in channel. -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the channel.Retrieve the consumer tag.voidhandleCancel(String consumerTag) No-op implementation ofConsumer.handleCancel(String)voidhandleCancelOk(String consumerTag) No-op implementation ofConsumer.handleCancelOk(java.lang.String).voidhandleConsumeOk(String consumerTag) Stores the most recently passed-in consumerTag - semantically, there should be only one.voidhandleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) voidhandleRecoverOk(String consumerTag) No-op implementation ofConsumer.handleRecoverOk(java.lang.String).voidhandleShutdownSignal(String consumerTag, ShutdownSignalException sig) No-op implementation ofConsumer.handleShutdownSignal(java.lang.String, com.rabbitmq.client.ShutdownSignalException).
-
Constructor Details
-
DefaultConsumer
Constructs a new instance and records its association to the passed-in channel.- Parameters:
channel- the channel to which this consumer is attached
-
-
Method Details
-
handleConsumeOk
Stores the most recently passed-in consumerTag - semantically, there should be only one.- Specified by:
handleConsumeOkin interfaceConsumer- Parameters:
consumerTag- the consumer tag associated with the consumer- See Also:
-
handleCancelOk
No-op implementation ofConsumer.handleCancelOk(java.lang.String).- Specified by:
handleCancelOkin interfaceConsumer- Parameters:
consumerTag- the defined consumer tag (client- or server-generated)
-
handleCancel
No-op implementation ofConsumer.handleCancel(String)- Specified by:
handleCancelin interfaceConsumer- Parameters:
consumerTag- the defined consumer tag (client- or server-generated)- Throws:
IOException
-
handleShutdownSignal
No-op implementation ofConsumer.handleShutdownSignal(java.lang.String, com.rabbitmq.client.ShutdownSignalException).- Specified by:
handleShutdownSignalin interfaceConsumer- Parameters:
consumerTag- the consumer tag associated with the consumersig- aShutdownSignalExceptionindicating the reason for the shut down
-
handleRecoverOk
No-op implementation ofConsumer.handleRecoverOk(java.lang.String).- Specified by:
handleRecoverOkin interfaceConsumer- Parameters:
consumerTag- the consumer tag associated with the consumer
-
handleDelivery
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException No-op implementation ofConsumer.handleDelivery(java.lang.String, com.rabbitmq.client.Envelope, com.rabbitmq.client.AMQP.BasicProperties, byte[]).- Specified by:
handleDeliveryin interfaceConsumer- 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:
-
getChannel
Retrieve the channel.- Returns:
- the channel this consumer is attached to.
-
getConsumerTag
Retrieve the consumer tag.- Returns:
- the most recently notified consumer tag.
-