HydraExpress™ C++ API Reference Guide

Product Documentation:
   HydraExpress C++
Documentation Home
List of all members | Public Member Functions
rwsf::MessageInfoHandlerChain Class Reference

Represents a functor for invoking a series of handlers. More...

#include <rwsf/handlers/MessageInfoHandlerChain.h>

Inheritance diagram for rwsf::MessageInfoHandlerChain:
rwsf::HandleBase

Public Member Functions

 MessageInfoHandlerChain ()
 
void addHandlerChain (const rwsf::MessageInfoHandlerChain &chain, int typeFilter=-1)
 
std::string getName () const
 
void init (const rwsf::Config &config)
 
void invoke (rwsf::MessageInfo &message)
 
- Public Member Functions inherited from rwsf::HandleBase
bool isValid (void) const
 
bool operator!= (const HandleBase &second) const
 
bool operator== (const HandleBase &second) const
 

Additional Inherited Members

- Protected Member Functions inherited from rwsf::HandleBase
 HandleBase (void)
 
 HandleBase (StaticCtor)
 
 HandleBase (BodyBase *body)
 
 HandleBase (const HandleBase &second)
 
virtual ~HandleBase (void)
 
BodyBase & body (void) const
 
HandleBaseoperator= (const HandleBase &second)
 

Detailed Description

Class MessageInfoHandlerChain represents a functor for invoking a series of handlers.

Each handler is registered along with a type, indicating when the handler should be executed (on input, output, or fault). When the chain is executed, each input handler is invoked and each output or fault handler is placed on a stack to be executed. After all of the handlers have been processed, the stack is executed in reverse, invoking each out handler. If a fault is indicated (by invoke from one of the handlers returning false), the chain is interrupted, and each out and fault handler in the stack is executed.

Constructor & Destructor Documentation

rwsf::MessageInfoHandlerChain::MessageInfoHandlerChain ( )

Creates a new handler chain. This constructor provides the DefaultConstructible concept for templates that require this concept.

Member Function Documentation

void rwsf::MessageInfoHandlerChain::addHandlerChain ( const rwsf::MessageInfoHandlerChain chain,
int  typeFilter = -1 
)

Appends handlers from chain to this instance of rwsf::MessageInfoHandlerChain. By default, all handlers from chain are appended. The parameter typeFilter allows you to specify a subset of handlers to add. typeFilter is a bit-mask of any of the following values:

  • rwsf::MessageInfoHandler::HANDLER_REQUEST
  • rwsf::MessageInfoHandler::HANDLER_RESPONSE
std::string rwsf::MessageInfoHandlerChain::getName ( ) const

Returns the name associated with this handler chain.

void rwsf::MessageInfoHandlerChain::init ( const rwsf::Config config)

Initializes the handler chain based on the configuration options in config. Please see the section on Agent connectors in the User's Guide for more information on how to configure handler chains.

void rwsf::MessageInfoHandlerChain::invoke ( rwsf::MessageInfo message)

Invokes this handler chain on message. This executes all request handlers until false is returned from the individual handler, or an exception is thrown. In the former case, the response handlers are then run until false is returned from the individual handler, or an exception is thrown. If an exception is thrown from any handler, that exception is propagated out, thus terminating this invoke() function call with the thrown exception.

Copyright © 2019 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.