void OnQueryResponse(IRubyMessage message)
        {
            try {
                ResponseMessage response = ResponseMessage.ParseFrom(message.Message);
                KeyValuePair    endpoint;
                if (KeyValuePairs.Find(RubyStrings.kQueryResponseEndpointKey,
                                       response.ReponsesList, out endpoint))
                {
                    // create a new reporter using the informations of the found service.
                    reporter_ = new ServiceReporter(registry_, context_, endpoint.Value);

                    if (predicate_ != null)
                    {
                        reporter_.Start(period_, period_unit_);
                    }
                    else
                    {
                        reporter_.Start(period_, period_unit_, predicate_);
                    }
                }
            } catch (Exception e) {
                logger_.Error(
                    string.Format(R.Log_MethodThrowsException, "OnQueryResponse",
                                  kClassName), e);
            }
        }
 public DynamicServiceReporter(IMetricsRegistry registry,
   ZmqContext context, IRubyServiceHost service_host) {
   service_host_ = service_host;
   reporter_ = new NopMetricsReporter();
   period_ = 5;
   period_unit_ = TimeUnit.Seconds;
   registry_ = registry;
   logger_ = MetricsLogger.ForCurrentProcess;
   context_ = context;
 }
 public DynamicServiceReporter(IMetricsRegistry registry,
                               ZmqContext context, IRubyServiceHost service_host)
 {
     service_host_ = service_host;
     reporter_     = new NopMetricsReporter();
     period_       = 5;
     period_unit_  = TimeUnit.Seconds;
     registry_     = registry;
     logger_       = MetricsLogger.ForCurrentProcess;
     context_      = context;
 }
    void OnQueryResponse(IRubyMessage message) {
      try {
        ResponseMessage response = ResponseMessage.ParseFrom(message.Message);
        KeyValuePair endpoint;
        if (KeyValuePairs.Find(RubyStrings.kQueryResponseEndpointKey,
          response.ReponsesList, out endpoint)) {

          // create a new reporter using the informations of the found service.
          reporter_ = new ServiceReporter(registry_, context_, endpoint.Value);

          if (predicate_ != null) {
            reporter_.Start(period_, period_unit_);
          } else {
            reporter_.Start(period_, period_unit_, predicate_);
          }
        }
      } catch (Exception e) {
        logger_.Error(
          string.Format(R.Log_MethodThrowsException, "OnQueryResponse",
            kClassName), e);
      }
    }