rwsf::MessageListenerImp rwsf::MessageHandlerImp
doInit() doReset() doStart() doStop() getProperty() |
init() initServer() invoke() isStopped() log() |
MessageListenerImp() reset() setHandler() setProperty() start() |
stop() ~MessageListenerImp() |
#include <rw/rwsf/soapworx/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).
Note: Use rwsf_DEFINE_MESSAGE_HANDLER if the listener is compiled into a library, and rwsf_DEFINE_STATIC_MESSAGE_HANDLER if the listener is compiled into an executable, such as creating a listener to be used on a client for the message pattern notification.
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
#define rwsf_DEFINE_MESSAGE_HANDLER(NAME)
This macro must be defined for each listener. See Part II, "Global Reference."
MessageListenerImp();
Default constructor.
virtual ~MessageListenerImp();
Virtual destructor.
virtual void invoke(rwsf::CallInfo& callInfo);
Handles an incoming message, forwarding it to the service implementation. The callInfo object contains metadata contained in the header.
virtual void init(const rwsf::Config& initParams);
Initializes the listener. The initParams object contains initialization and startup parameters. Starts the listening thread when the initParam auto-start parameter is set to true. Finally, sets the value of isInitialized_ to true.
bool isStopped();
Returns the value of isStopped_.
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 start();
Starts the listener thread using these steps:
Calls the protected virtual member function initServer(), which is expected to perform whatever setup the listener thread may require.
Starts the listener thread which has as its entry point a call to the protected member function doStart().
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:
Calls the protected virtual member function doStop(), which is expected to perform whatever shutdown the listener thread may require.
Joins the listener thread.
Sets the flag isStopped_ to true.
virtual void setProperty(const std::string& key, const std::string& value);
Sets a key/value property on the listener.
virtual std::string getProperty(const std::string& key);
Given a property key, returns its value.
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 ("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 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.
virtual 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.
virtual void doReset() = 0;
Pure virtual function.
virtual 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.
virtual 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().
virtual 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.
#define rwsf_DEFINE_rwsf_LISTENER(NAME)
Note: This macro is deprecated. See Part II, "Global Reference."
©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.