#include <ClientChannel.h>
Inheritance diagram for qpid::client::Channel:
Public Member Functions | |
Channel (bool transactional=false, u_int16_t prefetch=500) | |
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 qpid::framing::FieldTable &args, bool synch=true) |
Binds a queue to an exchange. | |
void | consume (Queue &queue, std::string &tag, MessageListener *listener, int ackMode=NO_ACK, bool noLocal=false, bool synch=true, const qpid::framing::FieldTable *fields=0) |
Creates a 'consumer' for a queue. | |
void | cancel (std::string &tag, bool synch=true) |
Cancels a subscription previously set up through a call to consume(). | |
bool | get (Message &msg, const Queue &queue, int 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 | commit () |
For a transactional channel this will commit all publications and acknowledgements since the last commit (or the channel was opened if there has been no previous commit). | |
void | rollback () |
For a transactional channel, this will rollback any publications or acknowledgements. | |
void | setPrefetch (u_int16_t prefetch) |
Change the prefetch in use. | |
void | start () |
Start message dispatching on a new thread. | |
void | run () |
Do message dispatching on this thread. | |
void | close () |
Closes a channel, stopping any message dispatching. | |
void | setReturnedMessageHandler (ReturnedMessageHandler *handler) |
Set a handler for this channel that will process any returned messages. |
loosely a session of work. It is through a channel that most of the AMQP 'methods' are exposed.
qpid::client::Channel::Channel | ( | bool | transactional = false , |
|
u_int16_t | prefetch = 500 | |||
) |
Creates a channel object.
transactional | if true, the publishing and acknowledgement of messages will be transactional and can be committed or aborted in atomic units ( |
prefetch | specifies the number of unacknowledged messages the channel is willing to have sent to it asynchronously |
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.
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.
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 | |||
) |
void qpid::client::Channel::deleteQueue | ( | Queue & | queue, | |
bool | ifunused = false , |
|||
bool | ifempty = false , |
|||
bool | synch = true | |||
) |
void qpid::client::Channel::bind | ( | const Exchange & | exchange, | |
const Queue & | queue, | |||
const std::string & | key, | |||
const qpid::framing::FieldTable & | args, | |||
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.
void qpid::client::Channel::consume | ( | Queue & | queue, | |
std::string & | tag, | |||
MessageListener * | listener, | |||
int | ackMode = NO_ACK , |
|||
bool | noLocal = false , |
|||
bool | synch = true , |
|||
const qpid::framing::FieldTable * | fields = 0 | |||
) |
Creates a 'consumer' for a queue.
Messages in (or arriving at) that queue will be delivered to consumers asynchronously.
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. |
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 | ( | std::string & | tag, | |
bool | synch = true | |||
) |
Cancels a subscription previously set up through a call to consume().
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 |
Synchronous pull of a message from a queue.
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 ( |
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).
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()). |
void qpid::client::Channel::commit | ( | ) |
For a transactional channel this will commit all publications and acknowledgements since the last commit (or the channel 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.
Transactionailty of a channel is specified when the channel object is created (
void qpid::client::Channel::rollback | ( | ) |
For a transactional channel, this will rollback any publications or acknowledgements.
It will be as if the ppblished messages were never sent and the acknowledged messages were never consumed.
void qpid::client::Channel::setReturnedMessageHandler | ( | ReturnedMessageHandler * | handler | ) |