186 lines
6.6 KiB
C++
186 lines
6.6 KiB
C++
/**
|
|
* ChannelHandler.h
|
|
*
|
|
* Interface that should be implemented by a user of the AMQP library,
|
|
* and that is passed to the Connection::createChannel() method.
|
|
*
|
|
* This interface contains a number of methods that are called when
|
|
* the channel changes state.
|
|
*
|
|
* @copyright 2014 Copernica BV
|
|
*/
|
|
|
|
/**
|
|
* Set up namespace
|
|
*/
|
|
namespace AMQP {
|
|
|
|
/**
|
|
* Class definition
|
|
*/
|
|
class ChannelHandler
|
|
{
|
|
public:
|
|
/**
|
|
* Method that is called when the channel was succesfully created.
|
|
* @param channel the channel that is ready
|
|
*/
|
|
virtual void onReady(Channel *channel) {}
|
|
|
|
/**
|
|
* An error has occured on the channel
|
|
* The channel is no longer usable after an error has occured on it
|
|
* @param channel the channel on which the error occured
|
|
* @param message human readable error message
|
|
*/
|
|
virtual void onError(Channel *channel, const std::string &message) {}
|
|
|
|
/**
|
|
* Method that is called when the channel was paused
|
|
* This is the result of a call to Channel::pause()
|
|
* @param channel the channel that is now paused
|
|
*/
|
|
virtual void onPaused(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when the channel was resumed
|
|
* This is the result of a call to Channel::resume()
|
|
* @param channel the channel that is no longer paused
|
|
*/
|
|
virtual void onResumed(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when a channel is closed
|
|
* This is the result of a call to Channel::close()
|
|
* @param channel the channel that is closed
|
|
*/
|
|
virtual void onClosed(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when a transaction was started
|
|
* This is the result of a call to Channel::startTransaction()
|
|
* @param channel the channel on which the transaction was started
|
|
*/
|
|
virtual void onTransactionStarted(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when a transaction was committed
|
|
* This is the result of a call to Channel::commitTransaction()
|
|
* @param channel the channel on which the transaction was committed
|
|
*/
|
|
virtual void onTransactionCommitted(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when a transaction was rolled back
|
|
* This is the result of a call to Channel::rollbackTransaction()
|
|
* @param channel the channel on which the transaction was rolled back
|
|
*/
|
|
virtual void onTransactionRolledBack(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when an exchange is bound
|
|
* This is the result of a call to Channel::bindExchange()
|
|
* @param channel the channel on which the exchange was bound
|
|
*/
|
|
virtual void onExchangeBound(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when an exchange is unbound
|
|
* This is the result of a call to Channel::unbindExchange()
|
|
* @param channel the channel on which the exchange was unbound
|
|
*/
|
|
virtual void onExchangeUnbound(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when an exchange is deleted
|
|
* This is the result of a call to Channel::deleteExchange()
|
|
* @param channel the channel on which the exchange was deleted
|
|
*/
|
|
virtual void onExchangeDeleted(Channel *channel) {}
|
|
|
|
/**
|
|
* Mehod that is called when an exchange is declared
|
|
* This is the result of a call to Channel::declareExchange()
|
|
* @param channel the channel on which the exchange was declared
|
|
*/
|
|
virtual void onExchangeDeclared(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when a queue is declared
|
|
* This is the result of a call to Channel::declareQueue()
|
|
* @param channel the channel on which the queue was declared
|
|
* @param name name of the queue
|
|
* @param messageCount number of messages in queue
|
|
* @param consumerCount number of active consumers
|
|
*/
|
|
virtual void onQueueDeclared(Channel *channel, const std::string &name, uint32_t messageCount, uint32_t consumerCount) {}
|
|
|
|
/**
|
|
* Method that is called when a queue is bound
|
|
* This is the result of a call to Channel::bindQueue()
|
|
* @param channel the channel on which the queue was bound
|
|
*/
|
|
virtual void onQueueBound(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when a queue is deleted
|
|
* This is the result of a call to Channel::deleteQueue()
|
|
* @param channel the channel on which the queue was deleted
|
|
* @param messageCount number of messages deleted along with the queue
|
|
*/
|
|
virtual void onQueueDeleted(Channel *channel, uint32_t messageCount) {}
|
|
|
|
/**
|
|
* Method that is called when a queue is unbound
|
|
* This is the result of a call to Channel::unbindQueue()
|
|
* @param channel the channel on which the queue was unbound
|
|
*/
|
|
virtual void onQueueUnbound(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when a queue is purged
|
|
* This is the result of a call to Channel::purgeQueue()
|
|
* @param channel the channel on which the queue was emptied
|
|
* @param messageCount number of message purged
|
|
*/
|
|
virtual void onQueuePurged(Channel *channel, uint32_t messageCount) {}
|
|
|
|
/**
|
|
* Method that is called when the quality-of-service was changed
|
|
* This is the result of a call to Channel::setQos()
|
|
* @param channel the channel on which the qos was set
|
|
*/
|
|
virtual void onQosSet(Channel *channel) {}
|
|
|
|
/**
|
|
* Method that is called when a consumer was started
|
|
* This is the result of a call to Channel::consume()
|
|
* @param channel the channel on which the consumer was started
|
|
* @param tag the consumer tag
|
|
*/
|
|
virtual void onConsumerStarted(Channel *channel, const std::string &tag) {}
|
|
|
|
/**
|
|
* Method that is called when a consumer was stopped
|
|
* This is the result of a call to Channel::cancel()
|
|
* @param channel the channel on which the consumer was stopped
|
|
* @param tag the consumer tag
|
|
*/
|
|
virtual void onConsumerStopped(Channel *channel, const std::string &tag) {}
|
|
|
|
/**
|
|
* Method that is called when a message has been received on a channel
|
|
* @param channel the channel on which the consumer was started
|
|
* @param message the consumed message
|
|
*/
|
|
virtual void onReceived(Channel *channel, const Message &message) {}
|
|
|
|
|
|
|
|
};
|
|
|
|
/**
|
|
* End of namespace
|
|
*/
|
|
}
|