Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 //  The contents of this file are subject to the Mozilla Public License
 //  Version 1.1 (the "License"); you may not use this file except in
 //  compliance with the License. You may obtain a copy of the License
 //  at http://www.mozilla.org/MPL/
 //
 //  Software distributed under the License is distributed on an "AS IS"
 //  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 //  the License for the specific language governing rights and
 //  limitations under the License.
//
//  The Original Code is RabbitMQ.
//
//  The Initial Developer of the Original Code is VMware, Inc.
//  Copyright (c) 2007-2011 VMware, Inc.  All rights reserved.
//
package com.rabbitmq.client;
Interface for application callback objects to receive notifications and messages from a queue by subscription. Most implementations will subclass DefaultConsumer.

The methods of this interface are invoked in a dispatch thread which is separate from the Connection's thread. This allows Consumers to call Channel or Connection methods without causing a deadlock.

The Consumers on a particular Channel are invoked serially on one or more dispatch threads. Consumers should avoid executing long-running code because this will delay dispatch of messages to other Consumers on the same Channel.

public interface Consumer {
    
Called when the consumer is registered by a call to any of the Channel.basicConsume(java.lang.String,com.rabbitmq.client.Consumer) methods.

Parameters:
consumerTag the consumer tag associated with the consumer
    void handleConsumeOk(String consumerTag);

    
Called when the consumer is cancelled by a call to Channel.basicCancel(java.lang.String).

Parameters:
consumerTag the consumer tag associated with the consumer
    void handleCancelOk(String consumerTag);

    
Called when the consumer is cancelled for reasons other than by a call to Channel.basicCancel(java.lang.String). For example, the queue has been deleted. See handleCancelOk(java.lang.String) for notification of consumer cancellation due to Channel.basicCancel(java.lang.String).

Parameters:
consumerTag the consumer tag associated with the consumer
Throws:
java.io.IOException
    void handleCancel(String consumerTagthrows IOException;

    
Called when either the channel or the underlying connection has been shut down.

Parameters:
consumerTag the consumer tag associated with the consumer
sig a ShutdownSignalException indicating the reason for the shut down
    void handleShutdownSignal(String consumerTagShutdownSignalException sig);

    
Called when a basic.recover-ok is received in reply to a basic.recover. All messages received before this is invoked that haven't been ack'ed will be re-delivered. All messages received afterwards won't be.

Parameters:
consumerTag the consumer tag associated with the consumer
    void handleRecoverOk(String consumerTag);

    
Called when a basic.deliver is received for this 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
    void handleDelivery(String consumerTag,
                        Envelope envelope,
                        AMQP.BasicProperties properties,
                        byte[] body)
        throws IOException;
New to GrepCode? Check out our FAQ X