The Request-Response Operation
The code below is an excerpt from WeatherSummaryImp.cpp. It shows the message handler registration macro and the endpoint implementation for the request-response operation method subscribe().
RWSF_DEFINE_MESSAGE_HANDLER(WeatherSummaryImp)
void
WeatherSummaryImp::subscribe(rwsf::CallInfo& callInfo,
const std::string& host_in, const std::string& port_in,
const std::string& transportName_in,
bool& status_out, std::string& message_out) //1
{
std::string location = createLocation(transportName_in,
host_in, port_in); //2
WeatherSummaryNotificationProxy notifProxy =
WeatherSummaryNotificationProxy::make(location); //3
bool result = notifProxy.verifySubscription(); //4
if (result) { //5
subscriptions_.insert(subscriptions_.end(), location);
message_out = "OK";
}
else {
message_out = "Unable to verify callback server.";
}
status_out = result;
}
This file also defines the unsubscribe() operation method, which is very similar to above except for the logic that determines the response data. See the WeatherSummaryImp.cpp file in the example if you are interested in the specifics.