rwsf::MessageListenerImprwsf::MessageHandlerImp
doInit() doReset() doStart() doStop() getProperty() |
init() initServer() invoke() isStopped() log() |
MessageListenerImp() reset() setHandler() setProperty() start() |
stop() ~MessageListenerImp() |
#include rwsf/webservice/listener/MessageListenerImp.h
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:
Implement the member functions initServer(), doStart(), and doStop().
Define the macro RWSF_DEFINE_MESSAGE_HANDLER(NAME).
Configure the listener in the configuration file client-transports.xml, or use this class to set properties.
For more information, see Section 11.6, "Creating a Transport," in the HydraExpress Web Service Development Guide.
MessageListenerImp();
Default constructor.
virtual ~MessageListenerImp();
Virtual destructor.
std::string getProperty(const std::string & value);
Given a property key, returns its value.
void init(const rwsf::Config & initParams);
Reimplements method in rwsf::MessageHandlerImp
Base class documentation:
Virtual. Initializes this handler. The values of the parameter initParams comes from the handlers.xmlfile defining the chains for this service.
Implementation documentation:
Initializes the listener. The initParams object contains initialization and startup parameters. Starts the listening thread when the initParamauto-start parameter is set to true. Finally, sets the value of isInitialized_ to true.
void invoke(rwsf::CallInfo & callInfo);
Reimplements method in rwsf::MessageHandlerImp
Base class documentation:
Virtual. Calling services that will use this handle access it through this method, which implements the main functionality of a service. To create a handler, extend this class and implement this method in the derived class.
Implementation documentation:
Handles an incoming message, forwarding it to the service implementation. The callInfo object contains metadata contained in the header.
bool isStopped();
Returns the value of isStopped_.
void 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. The log level defaults to Error.
void 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.
void reset();
Calls doReset(); sets the value of isInitialized_ to false and isStopped_ to true. If the listener object is still running, throws a rwsf::Exception.
void setHandler(const rwsf::MessageHandler & handler);
Accepts the incoming handler, making it available to invoke() and other methods. The handler object handler should have a body of the type rwsf::MessageService. (Typically the rwsf::MessageService is configured automatically when the client's handler configuration files ("\c client-handlers.xml") is processed, and is looked up via the rwsf::HandlerManager::findHandler()with the name of the service listed in the client-handlers file.
void setProperty(const std::string & key, const std::string & value);
Sets a key/value property on the listener.
void start();
Starts the listener thread using these steps:
Checks to see if this listener has been initialized. If isInitialized_ is false, throws a rwsf::Exception.
void stop();
Sops listener thread using these steps:
void doInit(const rwsf::Config & initParams) = 0;
Pure virtual function. In derived classes, init()calls this method to handle any initialization specific to the implementation.
void doReset() = 0;
Pure virtual function.
void doStart() = 0;
Pure virtual function. In derived classes, this method is the entry point for the listening thread, which is spawned in start() after calling initServer().
void doStop() = 0;
Pure virtual function. In the derived classes, this method is called by stop()to handle any listener thread shutdown specific to the implementation.
void initServer() = 0;
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.
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.