|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Consumer
Interface for application callback objects to receive notifications and messages from
a queue by subscription.
Most consumers will subclass DefaultConsumer
.
Note: all methods of this interface are invoked inside the Connection
's thread. This means they a) should be non-blocking and
generally do little work, b) must not call Channel
or
Connection
methods, or a deadlock will ensue. One way of
ensuring this is to use/subclass QueueingConsumer
.
Channel.basicConsume(java.lang.String, com.rabbitmq.client.Consumer)
,
Channel.basicCancel(java.lang.String)
Method Summary | |
---|---|
void |
handleCancelOk(java.lang.String consumerTag)
Called when the consumer is deregistered by a call to Channel.basicCancel(java.lang.String) . |
void |
handleConsumeOk(java.lang.String consumerTag)
Called when the consumer is first registered by a call to Channel.basicConsume(java.lang.String, com.rabbitmq.client.Consumer) . |
void |
handleDelivery(java.lang.String consumerTag,
Envelope envelope,
AMQP.BasicProperties properties,
byte[] body)
Called when a delivery appears for this consumer. |
void |
handleRecoverOk()
Called to notify the consumer that we've received a basic.recover-ok in reply to a basic.recover some other thread sent. |
void |
handleShutdownSignal(java.lang.String consumerTag,
ShutdownSignalException sig)
Called to the consumer that either the channel or the undelying connection has been shut down. |
Method Detail |
---|
void handleConsumeOk(java.lang.String consumerTag)
Channel.basicConsume(java.lang.String, com.rabbitmq.client.Consumer)
.
Note: if the consumer was registered with an empty string for its consumerTag, the server will have
autogenerated and replied with a fresh consumerTag.
consumerTag
- the defined consumerTag (either client- or server-generated)void handleCancelOk(java.lang.String consumerTag)
Channel.basicCancel(java.lang.String)
.
consumerTag
- the defined consumerTag (either client- or server-generated)void handleShutdownSignal(java.lang.String consumerTag, ShutdownSignalException sig)
consumerTag
- the defined consumerTag (either client- or server-generated)sig
- an exception object encapsulating the reason for shutdownvoid handleRecoverOk()
void handleDelivery(java.lang.String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws java.io.IOException
consumerTag
- the defined consumerTag (either client- or server-generated)envelope
- packaging data for the messageproperties
- content header data for the messagebody
- the message body (opaque client-specific byte array)
java.io.IOException
- if the consumer hits an I/O error while processing the message
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |