cMsg Messaging System  5.2
 All Classes Namespaces Files Functions Variables Friends
cmsg::cMsg Class Reference

Wraps most cMsg C calls, provides main functionality. More...

#include <cMsg.hxx>

Public Member Functions

 cMsg (const string &UDL, const string &name, const string &descr)
 Constructor for cMsg system object. More...
 
virtual ~cMsg (void)
 Destructor disconects from cMsg system. More...
 
virtual void connect () throw (cMsgException)
 Connects to cMsg system. More...
 
virtual void disconnect (void) throw (cMsgException)
 Disconnects from cMsg system. More...
 
virtual void send (cMsgMessage &msg) throw (cMsgException)
 Sends message. More...
 
virtual void send (cMsgMessage *msg) throw (cMsgException)
 Sends message. More...
 
virtual int syncSend (cMsgMessage &msg, const struct timespec *timeout=NULL) throw (cMsgException)
 Synchronously sends message. More...
 
virtual int syncSend (cMsgMessage *msg, const struct timespec *timeout=NULL) throw (cMsgException)
 Synchronously sends message. More...
 
virtual void * subscribe (const string &subject, const string &type, cMsgCallback *cb, void *userArg, const cMsgSubscriptionConfig *cfg=NULL) throw (cMsgException)
 Subscribes to subject,type and specifies callback, userArg. More...
 
virtual void * subscribe (const string &subject, const string &type, cMsgCallback &cb, void *userArg, const cMsgSubscriptionConfig *cfg=NULL) throw (cMsgException)
 Subscribes to subject,type and specifies callback,userArg. More...
 
virtual void unsubscribe (void *handle) throw (cMsgException)
 Unsubscribes. More...
 
virtual void subscriptionPause (void *handle) throw (cMsgException)
 Pause delivery of messages to the given subscription's callback. More...
 
virtual void subscriptionResume (void *handle) throw (cMsgException)
 Resume delivery of messages to the given subscription's callback if paused. More...
 
virtual void subscriptionQueueClear (void *handle) throw (cMsgException)
 Clear all messages from the given subscription callback's queue. More...
 
virtual int subscriptionQueueCount (void *handle) throw (cMsgException)
 Return the number of messages currently in the given subscription callback's queue. More...
 
virtual bool subscriptionQueueIsFull (void *handle) throw (cMsgException)
 Returns whether the given subscription callback's queue is full (true) or not. More...
 
virtual int subscriptionMessagesTotal (void *handle) throw (cMsgException)
 Return the total number of messages passed to the given subscription's callback. More...
 
virtual cMsgMessagesendAndGet (cMsgMessage &sendMsg, const struct timespec *timeout=NULL) throw (cMsgException)
 Sends message and gets reply. More...
 
virtual cMsgMessagesendAndGet (cMsgMessage *sendMsg, const struct timespec *timeout=NULL) throw (cMsgException)
 Sends message and gets reply. More...
 
virtual cMsgMessagesubscribeAndGet (const string &subject, const string &type, const struct timespec *timeout=NULL) throw (cMsgException)
 Subscribes to subject/type, returns one matching message, then unsubscribes. More...
 
virtual void flush (const struct timespec *timeout=NULL) throw (cMsgException)
 Flushes outgoing message queues. More...
 
virtual void start (void) throw (cMsgException)
 Enables delivery of messages to callbacks. More...
 
virtual void stop (void) throw (cMsgException)
 Disables delivery of messages to callbacks. More...
 
virtual void setUDL (const string &udl) throw (cMsgException)
 Sets the connection UDL. More...
 
virtual string getUDL (void) const
 Gets connection UDL. More...
 
virtual string getCurrentUDL (void) const throw (cMsgException)
 Gets UDL of the current connection, "null" if no connection. More...
 
virtual string getName (void) const
 Gets connection name. More...
 
virtual string getDescription (void) const
 Gets connection description. More...
 
virtual bool isConnected (void) const throw (cMsgException)
 True if connected. More...
 
virtual bool isReceiving (void) const throw (cMsgException)
 True if receiving messages. More...
 
virtual void setShutdownHandler (cMsgShutdownHandler *handler, void *userArg) throw (cMsgException)
 Sets shutdown handler. More...
 
virtual void shutdownClients (const string &client, int flag) throw (cMsgException)
 Shuts down a client. More...
 
virtual void shutdownServers (const string &server, int flag) throw (cMsgException)
 Shuts down a server. More...
 
virtual cMsgMessagemonitor (const string &monString) throw (cMsgException)
 Returns domain-dependent monitoring information. More...
 
virtual void setMonitoringString (const string &monString) throw (cMsgException)
 Sets monitoring string. More...
 

Detailed Description

Wraps most cMsg C calls, provides main functionality.

Definition at line 363 of file cMsg.hxx.

Constructor & Destructor Documentation

cMsg::cMsg ( const string &  UDL,
const string &  name,
const string &  descr 
)

Constructor for cMsg system object.

Parameters
UDLConnection UDL
nameName
descrDescription

Definition at line 1642 of file cMsgWrapper.cc.

cMsg::~cMsg ( void  )
virtual

Destructor disconects from cMsg system.

Exceptions
cMsgException

Definition at line 1654 of file cMsgWrapper.cc.

References disconnect().

Member Function Documentation

void cMsg::connect ( void  )
throw (cMsgException
)
virtual

Connects to cMsg system.

If a connection has already been made, a reconnection will be attempted. In a reconnection, if there is no current connection one will be made. If there is a current, healthy connection and if the UDL to which a connection attempt will be made is identical to the currentUDL, nothing is done. If there is a current, healthy connection, and if the UDL to which a connection attempt will be made is different from the current UDL, the current connection will be disconnected and a new connection attempted with the new UDL.

Exceptions
cMsgException

Definition at line 1673 of file cMsgWrapper.cc.

void cMsg::disconnect ( void  )
throw (cMsgException
)
virtual

Disconnects from cMsg system.

Exceptions
cMsgException

Definition at line 1699 of file cMsgWrapper.cc.

Referenced by ~cMsg().

void cMsg::flush ( const struct timespec *  timeout = NULL)
throw (cMsgException
)
virtual

Flushes outgoing message queues.

Parameters
timeoutTimeout
Exceptions
cMsgException

Definition at line 2131 of file cMsgWrapper.cc.

string cMsg::getCurrentUDL ( void  ) const
throw (cMsgException
)
virtual

Gets UDL of the current connection, "null" if no connection.

Returns
UDL of current connection
Exceptions
cMsgException

Definition at line 2248 of file cMsgWrapper.cc.

string cMsg::getDescription ( void  ) const
virtual

Gets connection description.

Returns
Description

Definition at line 2189 of file cMsgWrapper.cc.

string cMsg::getName ( void  ) const
virtual

Gets connection name.

Returns
Name

Definition at line 2202 of file cMsgWrapper.cc.

string cMsg::getUDL ( void  ) const
virtual

Gets connection UDL.

Returns
UDL

Definition at line 2215 of file cMsgWrapper.cc.

bool cMsg::isConnected ( void  ) const
throw (cMsgException
)
virtual

True if connected.

Returns
True if connected
Exceptions
cMsgException

Definition at line 2273 of file cMsgWrapper.cc.

bool cMsg::isReceiving ( void  ) const
throw (cMsgException
)
virtual

True if receiving messages.

Returns
True if receiving messages
Exceptions
cMsgException

Definition at line 2295 of file cMsgWrapper.cc.

cMsgMessage * cMsg::monitor ( const string &  monString)
throw (cMsgException
)
virtual

Returns domain-dependent monitoring information.

Parameters
monStringMonitoring request string
Returns
Message containing monitoring information in text field
Exceptions
cMsgException

Definition at line 2384 of file cMsgWrapper.cc.

void cMsg::send ( cMsgMessage msg)
throw (cMsgException
)
virtual

Sends message.

Parameters
msgMessage to send
Exceptions
cMsgException

Definition at line 1718 of file cMsgWrapper.cc.

Referenced by send().

void cMsg::send ( cMsgMessage msg)
throw (cMsgException
)
virtual

Sends message.

Parameters
msgMessage to send
Exceptions
cMsgException

Definition at line 1739 of file cMsgWrapper.cc.

References send().

cMsgMessage * cMsg::sendAndGet ( cMsgMessage sendMsg,
const struct timespec *  timeout = NULL 
)
throw (cMsgException
)
virtual

Sends message and gets reply.

Parameters
sendMsgMessage to send
timeoutTimeout
Returns
Reply message
Exceptions
cMsgException

Definition at line 2050 of file cMsgWrapper.cc.

cMsgMessage * cMsg::sendAndGet ( cMsgMessage sendMsg,
const struct timespec *  timeout = NULL 
)
throw (cMsgException
)
virtual

Sends message and gets reply.

Parameters
sendMsgMessage to send
timeoutTimeout
Returns
Reply message
Exceptions
cMsgException

Definition at line 2078 of file cMsgWrapper.cc.

void cMsg::setMonitoringString ( const string &  monString)
throw (cMsgException
)
virtual

Sets monitoring string.

Parameters
monStringMonitoring string
Exceptions
cMsgException

Definition at line 2410 of file cMsgWrapper.cc.

void cMsg::setShutdownHandler ( cMsgShutdownHandler *  handler,
void *  userArg 
)
throw (cMsgException
)
virtual

Sets shutdown handler.

Parameters
handlerShutdown handler
userArgArg passed to handler upon shutdown
Exceptions
cMsgException

Definition at line 2318 of file cMsgWrapper.cc.

void cMsg::setUDL ( const string &  udl)
throw (cMsgException
)
virtual

Sets the connection UDL.

Any subsequent failovers or reconnects will use the new UDL.

Parameters
udlnew UDL
Exceptions
cMsgException

Definition at line 2230 of file cMsgWrapper.cc.

void cMsg::shutdownClients ( const string &  client,
int  flag 
)
throw (cMsgException
)
virtual

Shuts down a client.

Parameters
clientThe client
flagShutdown flag
Exceptions
cMsgException

Definition at line 2340 of file cMsgWrapper.cc.

void cMsg::shutdownServers ( const string &  server,
int  flag 
)
throw (cMsgException
)
virtual

Shuts down a server.

Parameters
serverThe server
flagShutdown flag
Exceptions
cMsgException

Definition at line 2362 of file cMsgWrapper.cc.

void cMsg::start ( void  )
throw (cMsgException
)
virtual

Enables delivery of messages to callbacks.

Exceptions
cMsgException

Definition at line 2150 of file cMsgWrapper.cc.

void cMsg::stop ( void  )
throw (cMsgException
)
virtual

Disables delivery of messages to callbacks.

Exceptions
cMsgException

Definition at line 2169 of file cMsgWrapper.cc.

void * cMsg::subscribe ( const string &  subject,
const string &  type,
cMsgCallback cb,
void *  userArg,
const cMsgSubscriptionConfig cfg = NULL 
)
throw (cMsgException
)
virtual

Subscribes to subject,type and specifies callback, userArg.

Parameters
subjectSubject, can be regex
typeType, can be regex
cbCallback object to deliver messages to
userArgPassed to callback with message
cfgSubscription config object
Returns
Subscription handle, needed to unsubscribe
Exceptions
cMsgExceptionif subscription fails, object was not initialized, or for some underlying domain's reason

Definition at line 1800 of file cMsgWrapper.cc.

Referenced by subscribe().

void * cMsg::subscribe ( const string &  subject,
const string &  type,
cMsgCallback cb,
void *  userArg,
const cMsgSubscriptionConfig cfg = NULL 
)
throw (cMsgException
)
virtual

Subscribes to subject,type and specifies callback,userArg.

Parameters
subjectSubject, can be regex
typeType, can be regex
cbCallback object to deliver messages to
userArgPassed to callback with message
cfgSubscription config object
Returns
Subscription handle, needed to unsubscribe
Exceptions
cMsgExceptionif subscription fails, object was not initialized, or for some underlying domain's reason

Definition at line 1857 of file cMsgWrapper.cc.

References subscribe().

cMsgMessage * cMsg::subscribeAndGet ( const string &  subject,
const string &  type,
const struct timespec *  timeout = NULL 
)
throw (cMsgException
)
virtual

Subscribes to subject/type, returns one matching message, then unsubscribes.

Parameters
subjectSubject, can be regex
typeType, can be regex
timeoutTimeout
Returns
Matching message
Exceptions
cMsgException

Definition at line 2106 of file cMsgWrapper.cc.

int cMsg::subscriptionMessagesTotal ( void *  handle)
throw (cMsgException
)
virtual

Return the total number of messages passed to the given subscription's callback.

Parameters
handleSubscription handle
Returns
total number of messages passed to the given subscription's callback
Exceptions
cMsgException

Definition at line 1998 of file cMsgWrapper.cc.

void cMsg::subscriptionPause ( void *  handle)
throw (cMsgException
)
virtual

Pause delivery of messages to the given subscription's callback.

Parameters
handleSubscription handle
Exceptions
cMsgException

Definition at line 1903 of file cMsgWrapper.cc.

void cMsg::subscriptionQueueClear ( void *  handle)
throw (cMsgException
)
virtual

Clear all messages from the given subscription callback's queue.

Parameters
handleSubscription handle
Exceptions
cMsgException

Definition at line 1949 of file cMsgWrapper.cc.

int cMsg::subscriptionQueueCount ( void *  handle)
throw (cMsgException
)
virtual

Return the number of messages currently in the given subscription callback's queue.

Parameters
handleSubscription handle
Returns
number of messages currently in the given subscription callback's queue
Exceptions
cMsgException

Definition at line 1973 of file cMsgWrapper.cc.

bool cMsg::subscriptionQueueIsFull ( void *  handle)
throw (cMsgException
)
virtual

Returns whether the given subscription callback's queue is full (true) or not.

Parameters
handleSubscription handle
Returns
boolean stating whether the given subscription callback's queue is full or not
Exceptions
cMsgException

Definition at line 2023 of file cMsgWrapper.cc.

void cMsg::subscriptionResume ( void *  handle)
throw (cMsgException
)
virtual

Resume delivery of messages to the given subscription's callback if paused.

Parameters
handleSubscription handle
Exceptions
cMsgException

Definition at line 1926 of file cMsgWrapper.cc.

int cMsg::syncSend ( cMsgMessage msg,
const struct timespec *  timeout = NULL 
)
throw (cMsgException
)
virtual

Synchronously sends message.

Parameters
msgMessage to send
timeoutTimeout
Exceptions
cMsgException

Definition at line 1754 of file cMsgWrapper.cc.

Referenced by syncSend().

int cMsg::syncSend ( cMsgMessage msg,
const struct timespec *  timeout = NULL 
)
throw (cMsgException
)
virtual

Synchronously sends message.

Parameters
msgMessage to send
timeoutTimeout
Exceptions
cMsgException

Definition at line 1779 of file cMsgWrapper.cc.

References syncSend().

void cMsg::unsubscribe ( void *  handle)
throw (cMsgException
)
virtual

Unsubscribes.

Parameters
handleSubscription handle
Exceptions
cMsgException

Definition at line 1872 of file cMsgWrapper.cc.


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