32 #include <rsc/runtime/TypeStringTools.h>
33 #include <rsc/logging/Logger.h>
35 #include "../EventId.h"
36 #include "../Factory.h"
37 #include "../MetaData.h"
38 #include "../Handler.h"
43 using namespace rsc::runtime;
48 Server::IntlCallback::~IntlCallback() {
51 Server::CallbackBase::CallbackBase(
const string& requestType,
52 const string& replyType)
53 : requestType(requestType), replyType(replyType) {
77 logger(rsc::logging::Logger::getLogger(
"rsb.patterns.RequestHandler."
78 + methodName)), methodName(methodName), callback(callback),
83 return "RequestHandler";
87 stream <<
"methodName = " << methodName;
91 if (event->getMethod() !=
"REQUEST") {
94 if (event->getType() != callback->getRequestType()) {
95 RSCERROR(logger,
"Request type '" << event->getType()
96 <<
"' does not match expected request type '"
97 << callback->getRequestType() <<
"' of method '"
98 << methodName <<
"'");
103 reply->setScopePtr(informer->getScope());
104 reply->setMethod(
"REPLY");
105 reply->addCause(event->getEventId());
108 = callback->intlCall(methodName, event->getData());
109 reply->setType(returnData.first);
110 reply->setData(returnData.second);
111 }
catch (
const exception& e) {
112 reply->setType(typeName<string>());
113 reply->setData(boost::shared_ptr<string>(
new string(typeName(e) +
": " + e.what())));
114 reply->mutableMetaData().setUserInfo(
"rsb:error?",
"");
116 informer->publish(reply);
123 scope(scope), listenerConfig(listenerConfig), informerConfig(
133 if (
methods.count(methodName)) {
149 methods[methodName] = informer;