HydraExpress™ C++ API Reference Guide

Product Documentation:
   HydraExpress C++
Documentation Home
List of all members | Public Member Functions | Protected Member Functions
rwsf::MessageListenerImp Class Referenceabstract

Abstract base class for all listener implementations. More...

#include <rwsf/webservice/listener/MessageListenerImp.h>

Inheritance diagram for rwsf::MessageListenerImp:
rwsf::MessageHandlerImp rwsf::HttpMessageListener rwsf::HttpsMessageListener

Public Member Functions

 MessageListenerImp ()
 
virtual ~MessageListenerImp ()
 
virtual std::string getProperty (const std::string &key)
 
virtual void init (const rwsf::Config &initParams)
 
virtual void invoke (rwsf::CallInfo &callInfo)
 
bool isStopped ()
 
void log (const std::string &message, rwsf::CallInfo::LogLevel l=rwsf::CallInfo::Error)
 
void log (rwsf::CallInfo &callInfo, rwsf::CallInfo::LogLevel l=rwsf::CallInfo::Error)
 
virtual void setProperty (const std::string &key, const std::string &value)
 
- Public Member Functions inherited from rwsf::MessageHandlerImp
 MessageHandlerImp ()
 
virtual ~MessageHandlerImp ()
 
virtual void destroy ()
 

Protected Member Functions

virtual void doInit (const rwsf::Config &initParams)=0
 
virtual void doReset ()=0
 
virtual void doStart ()=0
 
virtual void doStop ()=0
 
virtual void initServer ()=0
 

Additional Inherited Members

Detailed Description

rwsf::MessageListenerImp is the abstract base class from which all listener body classes derive. Since listeners are handlers in RWSF, rwsf::MessageListenerImp derives from rwsf::MessageHandlerImp.

rwsf::MessageListenerImp implements the handle/body pattern in which rwsf::MessageListener is the handle, and rwsf::MessageListenerImp is the body.

For properties that can be set on a listener, and other details, see the handle class rwsf::MessageListener.

To create a new listener:

  1. Implement the member functions initServer(), doStart(), and doStop().
  2. Define the macro RWSF_DEFINE_MESSAGE_HANDLER(NAME).
  3. Configure the listener in the configuration file client-transports.xml, or use this class to set properties.

For more information on creating and using listeners, see the Web Service Development Guide.

Constructor & Destructor Documentation

rwsf::MessageListenerImp::MessageListenerImp ( )

Default constructor.

virtual rwsf::MessageListenerImp::~MessageListenerImp ( )
virtual

Virtual destructor.

Member Function Documentation

virtual void rwsf::MessageListenerImp::doInit ( const rwsf::Config initParams)
protectedpure virtual

Pure virtual function. In derived classes, init() calls this method to handle any initialization specific to the implementation.

Implemented in rwsf::HttpMessageListener, and rwsf::HttpsMessageListener.

virtual void rwsf::MessageListenerImp::doReset ( )
protectedpure virtual

Pure virtual function. In the derived classes, this method is called by reset() to handle resetting the listener.

Note
This method does not restart the listener.

Implemented in rwsf::HttpMessageListener.

virtual void rwsf::MessageListenerImp::doStart ( )
protectedpure virtual

Pure virtual function. In derived classes, this method is the entry point for the listening thread, which is spawned in start() after calling initServer().

Implemented in rwsf::HttpMessageListener.

virtual void rwsf::MessageListenerImp::doStop ( )
protectedpure virtual

Pure virtual function. In the derived classes, this method is called by stop() to handle any listener thread shutdown specific to the implementation.

Implemented in rwsf::HttpMessageListener.

virtual std::string rwsf::MessageListenerImp::getProperty ( const std::string &  key)
virtual

Given a property key, returns its value.

virtual void rwsf::MessageListenerImp::init ( const rwsf::Config initParams)
virtual

Initializes this handler. The values of the parameter initParams come from the handlers.xml file that defines the handler chains for this service.

Reimplemented from rwsf::MessageHandlerImp.

virtual void rwsf::MessageListenerImp::initServer ( )
protectedpure virtual

Pure virtual function. In derived classes, start() calls this method, which is expected to handle any setup needed by the listening thread specific to the implementation.

Implemented in rwsf::HttpMessageListener, and rwsf::HttpsMessageListener.

virtual void rwsf::MessageListenerImp::invoke ( rwsf::CallInfo callInfo)
virtual

Handles an incoming message, forwarding it to the service implementation. The callInfo object holds metadata extracted from the message header.

Reimplemented from rwsf::MessageHandlerImp.

bool rwsf::MessageListenerImp::isStopped ( )

Returns true if this listener is stopped, else false.

void rwsf::MessageListenerImp::log ( const std::string &  message,
rwsf::CallInfo::LogLevel  l = rwsf::CallInfo::Error 
)

Invokes the logger and adds a message to it, forwarding to the service implementation. Sets the log level to Error.

void rwsf::MessageListenerImp::log ( rwsf::CallInfo callInfo,
rwsf::CallInfo::LogLevel  l = rwsf::CallInfo::Error 
)

Invokes the logger and forwards to the service implementation. Sets the log level to Error.

virtual void rwsf::MessageListenerImp::setProperty ( const std::string &  key,
const std::string &  value 
)
virtual

Sets a key/value property on the listener.

Copyright © 2020 Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is registered trademark of Rogue Wave Software, Inc. in the United States and other countries, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.