std::string CIntMessage::findRequiredHeaderAsString( const std::string& key) const { std::string valueStr; SmartPtrIVariant value = findRequiredHeader(key); if (value) { valueStr = value->toString(); } return valueStr; }
CRecipientListRouterInstance::ChannelCollection CRecipientListRouterInstance::getTargetChannels( const SmartPtrIIntMessage& message) { CAF_CM_FUNCNAME("getTargetChannels"); ChannelCollection channels; CAF_CM_ENTER { CAF_CM_PRECOND_ISINITIALIZED(_isInitialized); // Static channels always get the message std::copy( _staticChannels.begin(), _staticChannels.end(), std::back_inserter(channels)); // Execute the selector expression(s) on the message // and add the channels for the expressions that return 'true' for (TConstIterator<SelectorChannelCollection> selector(_selectorChannels); selector; selector++) { SmartPtrIVariant evalResult = selector->first->evaluate(message); if (evalResult->isBool()) { if (CAF_CM_IS_LOG_DEBUG_ENABLED) { CAF_CM_LOG_DEBUG_VA3( "recipient-list-router [%s] selector-expression [%s] returned '%s'", _id.c_str(), selector->first->toString().c_str(), evalResult->toString().c_str()); } if (g_variant_get_boolean(evalResult->get())) { channels.push_back(selector->second); } } else { CAF_CM_EXCEPTIONEX_VA2( InvalidArgumentException, 0, "recipient-list-router [%s] illegal selector-expression [%s] : " "selector-expression results must return boolean values.", _id.c_str(), selector->first->toString().c_str()); } } } CAF_CM_EXIT; return channels; }