@Override
  public void init(DsConfiguration conf, DsMetaData metaData) {
    super.init(conf, metaData);
    log.info("Initializing handler: Mode =" + getMode());
    configuration = configurationFactory.load(configurationPath);
    messageProducer = KafkaProducerFactory.create(configuration.kafka());
    messageEncoder = MessageEncoderFactory.create(configuration);
    txFactory = new TxFactory();

    if (configuration.metrics().isEnabled()) {
      metricsReporter = MetricsReporterFactory.createReporter(configuration.metrics(), metrics);
    }
  }
  @Override
  public void destroy() {
    log.debug("destroy()... " + reportStatus());
    if (configuration.metricsEnabled()) {
      metricsReporter.stop();
    }

    messageProducer.terminate();
    super.destroy();
  }