private Timer getPushTimer(String topic) {
   if (!pushTimerByTopic.containsKey(topic)) {
     Timer pushTimer =
         HermesMetricsRegistry.getMetricRegistry()
             .timer(
                 MetricRegistry.name(SubscriptionPushService.class, topic, "MessageSubscription"));
     pushTimerByTopic.put(topic, pushTimer);
   }
   return pushTimerByTopic.get(topic);
 }
  @Override
  public void initialize() throws InitializationException {
    PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
    cm.setMaxTotal(100);

    m_httpClient = HttpClients.custom().setConnectionManager(cm).build();

    Builder b = RequestConfig.custom();
    Properties globalConfig = m_env.getGlobalConfig();
    // TODO config
    b.setConnectTimeout(
        Integer.valueOf(globalConfig.getProperty("gateway.subcription.connect.timeout", "2000")));
    b.setSocketTimeout(
        Integer.valueOf(globalConfig.getProperty("gateway.subscription.socket.timeout", "5000")));
    m_requestConfig = b.build();

    failedMeterGlobal =
        HermesMetricsRegistry.getMetricRegistry()
            .meter(
                MetricRegistry.name(
                    SubscriptionPushService.class, "MessageSubscription", "Failed"));
    requestMeterGlobal =
        HermesMetricsRegistry.getMetricRegistry()
            .meter(
                MetricRegistry.name(
                    SubscriptionPushService.class, "MessageSubscription", "Request"));
    requestSizeHistogramGlobal =
        HermesMetricsRegistry.getMetricRegistry()
            .histogram(
                MetricRegistry.name(
                    SubscriptionPushService.class, "MessageSubscription", "BodySize"));
    pushTimerGlobal =
        HermesMetricsRegistry.getMetricRegistry()
            .timer(MetricRegistry.name(SubscriptionPushService.class, "MessageSubscription"));
    failedMeterByTopic = new HashMap<>();
    requestMeterByTopic = new HashMap<>();
    requestSizeHistogramByTopic = new HashMap<>();
    pushTimerByTopic = new HashMap<>();
  }
  private void updateRequestMeter(String topic) {
    requestMeterGlobal.mark();

    if (!requestMeterByTopic.containsKey(topic)) {
      Meter requestMeter =
          HermesMetricsRegistry.getMetricRegistry()
              .meter(
                  MetricRegistry.name(
                      SubscriptionPushService.class, "SubscriptionPushService", topic, "Request"));
      requestMeterByTopic.put(topic, requestMeter);
    }

    Meter requestMeter = requestMeterByTopic.get(topic);
    requestMeter.mark();
  }
  private void updateRequestSizeHistogram(String topic, int length) {
    requestSizeHistogramGlobal.update(length);

    if (!requestSizeHistogramByTopic.containsKey(topic)) {
      Histogram requestSizeHistogram =
          HermesMetricsRegistry.getMetricRegistry()
              .histogram(
                  MetricRegistry.name(
                      SubscriptionPushService.class, "SubscriptionPushService", topic, "BodySize"));
      requestSizeHistogramByTopic.put(topic, requestSizeHistogram);
    }

    Histogram requestSizeHistogram = requestSizeHistogramByTopic.get(topic);
    requestSizeHistogram.update(length);
  }
  private void updateFailedMeter(String topic) {
    failedMeterGlobal.mark();

    if (!failedMeterByTopic.containsKey(topic)) {
      Meter failedMeter =
          HermesMetricsRegistry.getMetricRegistry()
              .meter(
                  MetricRegistry.name(
                      SubscriptionPushService.class, "SubscriptionPushService", topic, "Failed"));
      failedMeterByTopic.put(topic, failedMeter);
    }

    Meter failedMeter = failedMeterByTopic.get(topic);
    failedMeter.mark();
  }