m_CheckerEndpoint->RegisterPublication("checker::CheckResult");
GetEndpointManager()->RegisterEndpoint(m_CheckerEndpoint);
- // TODO: get rid of this
- ConfigObject::GetAllObjects()->OnObjectAdded.connect(bind(&CheckerComponent::NewServiceHandler, this, _1));
-
m_CheckTimer = make_shared<Timer>();
m_CheckTimer->SetInterval(10);
m_CheckTimer->OnTimerExpired.connect(bind(&CheckerComponent::CheckTimerHandler, this, _1));
mgr->UnregisterEndpoint(m_CheckerEndpoint);
}
-int CheckerComponent::NewServiceHandler(const ObjectSetEventArgs<ConfigObject::Ptr>& ea)
-{
- if (ea.Target->GetType() == "service")
- m_Services.push(ea.Target);
-
- return 0;
-}
-
int CheckerComponent::CheckTimerHandler(const TimerEventArgs& ea)
{
time_t now;
Application::Log("Accepted service '" + service.GetName() + "'");
+ /* force a service check */
+ m_CheckTimer->Reschedule(0);
+
ResponseMessage rm;
rm.SetID(id);
Timer::Ptr m_CheckTimer;
VirtualEndpoint::Ptr m_CheckerEndpoint;
- int NewServiceHandler(const ObjectSetEventArgs<ConfigObject::Ptr>& ea);
-
int CheckTimerHandler(const TimerEventArgs& ea);
int AssignServiceRequestHandler(const NewRequestEventArgs& nrea);
int DelegationComponent::AssignServiceResponseHandler(const ConfigObject::Ptr& service, const NewResponseEventArgs& nrea)
{
- if (nrea.TimedOut)
+ if (nrea.TimedOut) {
Application::Log("Service delegation for service '" + service->GetName() + "' timed out.");
- else
+ } else {
+ service->SetTag("checker", nrea.Sender->GetIdentity());
Application::Log("Service delegation for service '" + service->GetName() + "'was successful.");
+ }
return 0;
}