qpid::client::Channel Class Reference

THIS CLASS IS DEPRECATED AND WILL BE SHORTLY REMOVED. More...

#include <Channel.h>

Inheritance diagram for qpid::client::Channel:

Inheritance graph
[legend]
Collaboration diagram for qpid::client::Channel:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Channel (bool transactional=false, u_int16_t prefetch=0)
 Creates a channel object.
void declareExchange (Exchange &exchange, bool synch=true)
 Declares an exchange.
void deleteExchange (Exchange &exchange, bool synch=true)
 Deletes an exchange.
void declareQueue (Queue &queue, bool synch=true)
 Declares a Queue.
void deleteQueue (Queue &queue, bool ifunused=false, bool ifempty=false, bool synch=true)
 Deletes a Queue.
void bind (const Exchange &exchange, const Queue &queue, const std::string &key, const framing::FieldTable &args=framing::FieldTable(), bool synch=true)
 Binds a queue to an exchange.
void commit ()
 For a transactional channel this will commit all publications and acknowledgements since the last commit (or the channel that was opened if there has been no previous commit).
void rollback ()
 For a transactional channel, this will rollback any publications or acknowledgements.
void setPrefetch (uint32_t prefetch)
 Change the prefetch in use.
uint32_t getPrefetch ()
void start ()
 Start message dispatching on a new thread.
void close ()
 Close the channel.
bool isTransactional ()
 True if the channel is transactional.
bool isOpen () const
 True if the channel is open.
framing::ProtocolVersion getVersion () const
 Return the protocol version.
void consume (Queue &queue, const std::string &tag, MessageListener *listener, AckMode ackMode=NO_ACK, bool noLocal=false, bool synch=true, framing::FieldTable *fields=0)
 Creates a 'consumer' for a queue.
void cancel (const std::string &tag, bool synch=true)
 Cancels a subscription previously set up through a call to consume().
bool get (Message &msg, const Queue &queue, AckMode ackMode=NO_ACK)
 Synchronous pull of a message from a queue.
void publish (Message &msg, const Exchange &exchange, const std::string &routingKey, bool mandatory=false, bool immediate=false)
 Publishes (i.e.
void run ()
 Deliver incoming messages to the appropriate MessageListener.


Detailed Description

THIS CLASS IS DEPRECATED AND WILL BE SHORTLY REMOVED.

Represents an AMQP channel, i.e. loosely a session of work. It is through a channel that most of the AMQP 'methods' are exposed.


Constructor & Destructor Documentation

qpid::client::Channel::Channel ( bool  transactional = false,
u_int16_t  prefetch = 0 
)

Creates a channel object.

Parameters:
transactional if true, the publishing and acknowledgement of messages will be transactional and can be committed or aborted in atomic units (
See also:
commit(),

rollback()).

Parameters:
prefetch specifies the number of unacknowledged messages the channel is willing to have sent to it asynchronously.


Member Function Documentation

void qpid::client::Channel::declareExchange ( Exchange exchange,
bool  synch = true 
)

Declares an exchange.

In AMQP, Exchanges are the destinations to which messages are published. They have Queues bound to them and route messages they receive to those queues. The routing rules depend on the type of the exchange.

Parameters:
exchange an Exchange object representing the exchange to declare.
synch if true this call will block until a response is received from the broker.

void qpid::client::Channel::deleteExchange ( Exchange exchange,
bool  synch = true 
)

Deletes an exchange.

Parameters:
exchange an Exchange object representing the exchange to delete.
synch if true this call will block until a response is received from the broker.

void qpid::client::Channel::declareQueue ( Queue queue,
bool  synch = true 
)

Declares a Queue.

Parameters:
queue a Queue object representing the queue to declare.
synch if true this call will block until a response is received from the broker.

void qpid::client::Channel::deleteQueue ( Queue queue,
bool  ifunused = false,
bool  ifempty = false,
bool  synch = true 
)

Deletes a Queue.

Parameters:
queue a Queue object representing the queue to delete.
synch if true this call will block until a response is received from the broker.

void qpid::client::Channel::bind ( const Exchange exchange,
const Queue queue,
const std::string &  key,
const framing::FieldTable args = framing::FieldTable(),
bool  synch = true 
)

Binds a queue to an exchange.

The exact semantics of this (in particular how 'routing keys' and 'binding arguments' are used) depends on the type of the exchange.

Parameters:
exchange an Exchange object representing the exchange to bind to.
queue a Queue object representing the queue to be bound.
key the 'routing key' for the binding.
args the 'binding arguments' for the binding.
synch if true this call will block until a response is received from the broker.

void qpid::client::Channel::commit (  ) 

For a transactional channel this will commit all publications and acknowledgements since the last commit (or the channel that was opened if there has been no previous commit).

This will cause published messages to become available to consumers and acknowledged messages to be consumed and removed from the queues they were dispatched from.

A channel is specified as transactional or not when the channel object is created (

See also:
Channel()).

void qpid::client::Channel::rollback (  ) 

For a transactional channel, this will rollback any publications or acknowledgements.

It will be as if the published messages were never sent and the acknowledged messages were never consumed.

void qpid::client::Channel::close (  ) 

Close the channel.

Closing a channel that is not open has no effect.

bool qpid::client::Channel::isTransactional (  )  [inline]

True if the channel is transactional.

bool qpid::client::Channel::isOpen (  )  const

True if the channel is open.

framing::ProtocolVersion qpid::client::Channel::getVersion (  )  const [inline]

Return the protocol version.

void qpid::client::Channel::consume ( Queue queue,
const std::string &  tag,
MessageListener listener,
AckMode  ackMode = NO_ACK,
bool  noLocal = false,
bool  synch = true,
framing::FieldTable fields = 0 
)

Creates a 'consumer' for a queue.

Messages in (or arriving at) that queue will be delivered to consumers asynchronously.

Parameters:
queue a Queue instance representing the queue to consume from.
tag an identifier to associate with the consumer that can be used to cancel its subscription (if empty, this will be assigned by the broker).
listener a pointer to an instance of an implementation of the MessageListener interface. Messages received from this queue for this consumer will result in invocation of the received() method on the listener, with the message itself passed in.
ackMode the mode of acknowledgement that the broker should assume for this consumer.
See also:
AckMode
Parameters:
noLocal if true, this consumer will not be sent any message published by this connection.
synch if true this call will block until a response is received from the broker.

void qpid::client::Channel::cancel ( const std::string &  tag,
bool  synch = true 
)

Cancels a subscription previously set up through a call to consume().

Parameters:
tag the identifier used (or assigned) in the consume request that set up the subscription to be cancelled.
synch if true this call will block until a response is received from the broker.

bool qpid::client::Channel::get ( Message msg,
const Queue queue,
AckMode  ackMode = NO_ACK 
)

Synchronous pull of a message from a queue.

Parameters:
msg a message object that will contain the message headers and content if the call completes.
queue the queue to consume from.
ackMode the acknowledgement mode to use (
See also:
AckMode)
Returns:
true if a message was succcessfully dequeued from the queue, false if the queue was empty.

void qpid::client::Channel::publish ( Message msg,
const Exchange exchange,
const std::string &  routingKey,
bool  mandatory = false,
bool  immediate = false 
)

Publishes (i.e.

sends a message to the broker).

Parameters:
msg the message to publish.
exchange the exchange to publish the message to.
routingKey the routing key to publish with.
mandatory if true and the exchange to which this publish is directed has no matching bindings, the message will be returned (see setReturnedMessageHandler()).
immediate if true and there is no consumer to receive this message on publication, the message will be returned (see setReturnedMessageHandler()).


The documentation for this class was generated from the following file:

Generated on Thu May 15 22:24:02 2008 for Qpid by  doxygen 1.5.5