Implementing the Client-Side Notification and Solicit-Response Endpoints
Three extra classes are generated on the client side to support the notification pattern.
WeatherSummaryNotificationSkeleton: The skeleton that receives and handles the message, in this case on the client. Dispatches to the notification operation methods in the notification implementation.
WeatherSummaryNotificationBase: The base class for the client-side notification implementation. Similar to
WeatherSummaryBase, except on the client side.
WeatherSummaryNotificationImp: Derives from
WeatherSummarytNotificationBase. A sample implementation that you may use and edit.
In addition, three client-specific configuration files are used:
client-transports.xml client-handlers.xml client-objects.xml The code below is from WeatherSummaryNotificationImp.cpp. It shows both the weatherNotification() method that handles the notification message initiated by the server, and the endpoint implementation representing the client response to the server’s verifySubscription() solicit-response message.
RWSF_DEFINE_STATIC_MESSAGE_HANDLER("WeatherSummaryNotificationImp",
WeatherSummaryNotificationImp) //1
void
WeatherSummaryNotificationImp::weatherNotification(rwsf::CallInfo& callInfo,
const wsx::WeatherSummary& weatherData_in) //2
{
std::cout << "WEATHER UPDATE RECEIVED: " << std::endl
<< " zipcode = " << weatherData_in.getZipcode() << std::endl
<< " windSpeed = " << weatherData_in.getWindSpeed() << std::endl
<< " sky = " << weatherData_in.getSky() << std::endl
<< " temp = " << weatherData_in.getTemp() << std::endl
<< std::endl;
}
bool
WeatherSummaryNotificationImp::verifySubscription(rwsf::CallInfo& callInfo) //3
{
return true;
}