semaine::cms::receiver::Receiver Class Reference
#include <Receiver.h>
List of all members.
Public Member Functions |
| Receiver (const std::string &topicName) throw (CMSException) |
| Receiver (const std::string &topicName, const std::string &messageSelector) throw (CMSException) |
| Receiver (const std::string &cmsUrl, const std::string &cmsUser, const std::string &cmsPassword, const std::string &topicName) throw (CMSException) |
| Receiver (const std::string &cmsUrl, const std::string &cmsUser, const std::string &cmsPassword, const std::string &topicName, const std::string &messageSelector) throw (CMSException) |
virtual | ~Receiver () |
std::string | getMessageSelector () throw (CMSException) |
SEMAINEMessage * | receive () throw (CMSException, semaine::cms::exceptions::SystemConfigurationException) |
SEMAINEMessage * | receive (int timeout) throw (CMSException, semaine::cms::exceptions::SystemConfigurationException) |
SEMAINEMessage * | receiveNoWait () throw (CMSException, semaine::cms::exceptions::SystemConfigurationException) |
void | setMessageListener (SEMAINEMessageAvailableListener *aListener) throw (CMSException) |
SEMAINEMessageAvailableListener * | getMessageListener () |
virtual void | onMessage (const Message *m) |
SEMAINEMessage * | getMessage () |
bool | notPickedUp () |
Protected Member Functions |
virtual SEMAINEMessage * | createSEMAINEMessage (const Message *message) throw (semaine::cms::exceptions::MessageFormatException) |
Protected Attributes |
MessageConsumer * | consumer |
SEMAINEMessageAvailableListener * | listener |
CMSLogger * | log |
SEMAINEMessage * | message |
decaf::util::concurrent::Mutex | mutex |
Detailed Description
This class handles the common part to all message receivers in the SEMAINE system.
Two models of use are possible:
The Receiver itself covers basic text messages only. Subclasses should override createSEMAINEMessage(Message) to do a meaningful analysis of the JMS message in terms of a suitable subclass of SEMAINEMessage.
- Author:
- marc
Constructor & Destructor Documentation
Receiver::Receiver |
( |
const std::string & |
topicName |
) |
throw (CMSException) |
Create a receiver that will listen for all messages in the given Topic on the default JMS server. The default JMS server is determined as follows:
-
jms URL: default value
tcp://localhost:61616
;
-
jms User: default value empty;
-
jms Password: default value empty.
- Parameters:
-
| topic | the name of the CMS Topic to listen to. |
Receiver::Receiver |
( |
const std::string & |
topicName, |
|
|
const std::string & |
messageSelector | |
|
) |
| | throw (CMSException) |
Create a receiver that will listen only to the messages in the given Topic that will pass the given messageSelector, on the default JMS server. The default JMS server is determined as follows:
-
jms URL: default value
tcp://localhost:61616
;
-
jms User: default value empty;
-
jms Password: default value empty.
- Parameters:
-
Receiver::Receiver |
( |
const std::string & |
cmsUrl, |
|
|
const std::string & |
cmsUser, |
|
|
const std::string & |
cmsPassword, |
|
|
const std::string & |
topicName | |
|
) |
| | throw (CMSException) |
Create a receiver that will listen for all messages in the given Topic on the given JMS server.
- Parameters:
-
| cmsUrl | the url where to contact the JMS server |
| cmsUser | the username to use (can be an empty string) |
| cmsPassword | the password to use (can be an empty string) |
| topic | the name of the CMS Topic to listen to. |
Receiver::Receiver |
( |
const std::string & |
cmsUrl, |
|
|
const std::string & |
cmsUser, |
|
|
const std::string & |
cmsPassword, |
|
|
const std::string & |
topicName, |
|
|
const std::string & |
messageSelector | |
|
) |
| | throw (CMSException) |
Create a receiver that will listen only to the messages in the given Topic that will pass the given messageSelector, on the given JMS server.
- Parameters:
-
| cmsUrl | the url where to contact the JMS server |
| cmsUser | the username to use (can be an empty string) |
| cmsPassword | the password to use (can be an empty string) |
| topicName | the name of the JMS Topic to listen to. |
| messageSelector | a message selector expression, see e.g. http://java.sun.com/javaee/5/docs/api/javax/jms/Message.html for the detailed description. |
Receiver::~Receiver |
( |
|
) |
[virtual] |
Member Function Documentation
std::string semaine::cms::receiver::Receiver::getMessageSelector |
( |
|
) |
throw (CMSException) [inline] |
Get the message selector pattern active in this receiver to filter messages.
- Returns:
- a string representation of the selector pattern.
- Exceptions:
-
bool Receiver::notPickedUp |
( |
|
) |
|
void Receiver::onMessage |
( |
const Message * |
m |
) |
[virtual] |
Receives the next message that arrives within the specified timeout interval. This call blocks until a message arrives, the timeout expires, or this message consumer is closed. A timeout of zero never expires, and the call blocks indefinitely.
- Parameters:
-
| timeout | the timeout value (in milliseconds) |
- Returns:
- the next message produced for this message consumer, or null if the timeout expires or this message consumer is concurrently closed
- Exceptions:
-
| CMSException | if the CMS provider fails to receive the next message due to some internal error. |
| SystemConfigurationException | if the connection was not started before calling this method. |
Receives the next message produced for this message consumer. This call blocks indefinitely until a message is produced or until this message consumer is closed.
- Returns:
- the next message produced for this message consumer, or null if this message consumer is concurrently closed
- Exceptions:
-
| CMSException | if the CMS provider fails to receive the next message due to some internal error. |
| SystemConfigurationException | if the connection was not started before calling this method. |
Receives the next message if one is immediately available.
- Returns:
- the next message produced for this message consumer, or null if one is not available
- Exceptions:
-
| CMSException | if the CMS provider fails to receive the next message due to some internal error. |
| SystemConfigurationException | if the connection was not started before calling this method. |
Member Data Documentation
The documentation for this class was generated from the following files: