com.rabbitmq.client
Class DefaultConsumer

java.lang.Object
  extended by com.rabbitmq.client.DefaultConsumer
All Implemented Interfaces:
Consumer
Direct Known Subclasses:
QueueingConsumer

public class DefaultConsumer
extends java.lang.Object
implements Consumer

Convenience class providing a default implementation of Consumer. We anticipate that most Consumer implementations will subclass this class.


Constructor Summary
DefaultConsumer(Channel channel)
          Constructs a new instance and records its association to the passed-in channel.
 
Method Summary
 Channel getChannel()
          Retrieve the channel.
 java.lang.String getConsumerTag()
          Retrieve the consumer tag.
 void handleCancel(java.lang.String consumerTag)
          No-op implementation of Consumer.handleCancel(String)
 void handleCancelOk(java.lang.String consumerTag)
          No-op implementation of Consumer.handleCancelOk(java.lang.String).
 void handleConsumeOk(java.lang.String consumerTag)
          Stores the most recently passed-in consumerTag - semantically, there should be only one.
 void handleDelivery(java.lang.String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)
          No-op implementation of Consumer.handleDelivery(java.lang.String, com.rabbitmq.client.Envelope, com.rabbitmq.client.AMQP.BasicProperties, byte[]).
 void handleRecoverOk(java.lang.String consumerTag)
          No-op implementation of Consumer.handleRecoverOk(java.lang.String).
 void handleShutdownSignal(java.lang.String consumerTag, ShutdownSignalException sig)
          No-op implementation of Consumer.handleShutdownSignal(java.lang.String, com.rabbitmq.client.ShutdownSignalException).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConsumer

public DefaultConsumer(Channel channel)
Constructs a new instance and records its association to the passed-in channel.

Parameters:
channel - the channel to which this consumer is attached
Method Detail

handleConsumeOk

public void handleConsumeOk(java.lang.String consumerTag)
Stores the most recently passed-in consumerTag - semantically, there should be only one.

Specified by:
handleConsumeOk in interface Consumer
Parameters:
consumerTag - the consumer tag associated with the consumer
See Also:
Consumer.handleConsumeOk(java.lang.String)

handleCancelOk

public void handleCancelOk(java.lang.String consumerTag)
No-op implementation of Consumer.handleCancelOk(java.lang.String).

Specified by:
handleCancelOk in interface Consumer
Parameters:
consumerTag - the defined consumer tag (client- or server-generated)

handleCancel

public void handleCancel(java.lang.String consumerTag)
                  throws java.io.IOException
No-op implementation of Consumer.handleCancel(String)

Specified by:
handleCancel in interface Consumer
Parameters:
consumerTag - the defined consumer tag (client- or server-generated)
Throws:
java.io.IOException

handleShutdownSignal

public void handleShutdownSignal(java.lang.String consumerTag,
                                 ShutdownSignalException sig)
No-op implementation of Consumer.handleShutdownSignal(java.lang.String, com.rabbitmq.client.ShutdownSignalException).

Specified by:
handleShutdownSignal in interface Consumer
Parameters:
consumerTag - the consumer tag associated with the consumer
sig - a ShutdownSignalException indicating the reason for the shut down

handleRecoverOk

public void handleRecoverOk(java.lang.String consumerTag)
No-op implementation of Consumer.handleRecoverOk(java.lang.String).

Specified by:
handleRecoverOk in interface Consumer
Parameters:
consumerTag - the consumer tag associated with the consumer

handleDelivery

public void handleDelivery(java.lang.String consumerTag,
                           Envelope envelope,
                           AMQP.BasicProperties properties,
                           byte[] body)
                    throws java.io.IOException
No-op implementation of Consumer.handleDelivery(java.lang.String, com.rabbitmq.client.Envelope, com.rabbitmq.client.AMQP.BasicProperties, byte[]).

Specified by:
handleDelivery in interface Consumer
Parameters:
consumerTag - the consumer tag associated with the consumer
envelope - packaging data for the message
properties - content header data for the message
body - 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

getChannel

public Channel getChannel()
Retrieve the channel.

Returns:
the channel this consumer is attached to.

getConsumerTag

public java.lang.String getConsumerTag()
Retrieve the consumer tag.

Returns:
the most recently notified consumer tag.