private Properties getProducerProperties(String topic) {
    Properties configs = KafkaProperties.getDefaultKafkaProducerProperties();

    try {
      Properties envProperties = m_environment.getProducerConfig(topic);
      configs.putAll(envProperties);
    } catch (IOException e) {
      m_logger.warn("read producer config failed", e);
    }

    List<Partition> partitions = m_metaService.listPartitionsByTopic(topic);
    if (partitions == null || partitions.size() < 1) {
      return configs;
    }

    String producerDatasource = partitions.get(0).getWriteDatasource();
    Storage producerStorage = m_metaService.findStorageByTopic(topic);
    if (producerStorage == null) {
      return configs;
    }

    for (Datasource datasource : producerStorage.getDatasources()) {
      if (producerDatasource.equals(datasource.getId())) {
        Map<String, Property> properties = datasource.getProperties();
        for (Map.Entry<String, Property> prop : properties.entrySet()) {
          configs.put(prop.getValue().getName(), prop.getValue().getValue());
        }
        break;
      }
    }

    return KafkaProperties.overrideByCtripDefaultProducerSetting(configs);
  }
  @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<>();
  }