Implementing the Call to the Notification Endpoint
Let’s first look at an excerpt from WeatherSummaryImp.cpp showing the implementation for the one-way operation method weatherUpdate(). This implementation does not really do anything with the weather update, but uses the message’s arrival as the event that triggers a call to the notification operation method weatherNotification() in the specially-generated class WeatherSummaryNotificationProxy. In a more complete implementation, the data would probably be persisted in some way, but here the only point is to demonstrate how to implement a notification.
void WeatherSummaryImp::weatherUpdate(rwsf::CallInfo& callInfo,
const wsx::WeatherSummary& weatherData_in) //1
{
std::list<std::string>::iterator iter = subscriptions_.begin(); //2
for (; iter != subscriptions_.end(); ++iter) {
WeatherSummaryNotificationProxy notifProxy =
WeatherSummaryNotificationProxy::make(*iter); //3
notifProxy.weatherNotification(weatherData_in); //4
}
}