public void publishEvent(FaultPublisherDTO faultPublisherDTO) {
    DataBridgeFaultPublisherDTO dataBridgeFaultPublisherDTO =
        new DataBridgeFaultPublisherDTO(faultPublisherDTO);
    try {
      // Publish Fault Data
      dataPublisher.publish(
          DataPublisherUtil.getApiManagerAnalyticsConfiguration().getFaultStreamName(),
          DataPublisherUtil.getApiManagerAnalyticsConfiguration().getFaultStreamVersion(),
          System.currentTimeMillis(),
          new Object[] {"external"},
          null,
          (Object[]) dataBridgeFaultPublisherDTO.createPayload());

    } catch (AgentException e) {
      log.error("Error while publishing Fault event", e);
    }
  }
  public void init() {
    try {
      if (log.isDebugEnabled()) {
        log.debug("Initializing APIMgtUsageDataBridgeDataPublisher");
      }

      this.dataPublisher = getDataPublisher();

      // If Request Stream Definition does not exist.
      if (!dataPublisher.isStreamDefinitionAdded(
          DataPublisherUtil.getApiManagerAnalyticsConfiguration().getRequestStreamName(),
          DataPublisherUtil.getApiManagerAnalyticsConfiguration().getRequestStreamVersion())) {

        // Get Request Stream Definition
        String requestStreamDefinition = DataBridgeRequestPublisherDTO.getStreamDefinition();

        // Add Request Stream Definition.
        dataPublisher.addStreamDefinition(
            requestStreamDefinition,
            DataPublisherUtil.getApiManagerAnalyticsConfiguration().getRequestStreamName(),
            DataPublisherUtil.getApiManagerAnalyticsConfiguration().getRequestStreamVersion());
      }

      // If Response Stream Definition does not exist.
      if (!dataPublisher.isStreamDefinitionAdded(
          DataPublisherUtil.getApiManagerAnalyticsConfiguration().getResponseStreamName(),
          DataPublisherUtil.getApiManagerAnalyticsConfiguration().getResponseStreamVersion())) {

        // Get Response Stream Definition.
        String responseStreamDefinition = DataBridgeResponsePublisherDTO.getStreamDefinition();

        // Add Response Stream Definition.
        dataPublisher.addStreamDefinition(
            responseStreamDefinition,
            DataPublisherUtil.getApiManagerAnalyticsConfiguration().getResponseStreamName(),
            DataPublisherUtil.getApiManagerAnalyticsConfiguration().getResponseStreamVersion());
      }

      // If Fault Stream Definition does not exist.
      if (!dataPublisher.isStreamDefinitionAdded(
          DataPublisherUtil.getApiManagerAnalyticsConfiguration().getFaultStreamName(),
          DataPublisherUtil.getApiManagerAnalyticsConfiguration().getFaultStreamVersion())) {

        // Get Fault Stream Definition
        String faultStreamDefinition = DataBridgeFaultPublisherDTO.getStreamDefinition();

        // Add Fault Stream Definition;
        dataPublisher.addStreamDefinition(
            faultStreamDefinition,
            DataPublisherUtil.getApiManagerAnalyticsConfiguration().getFaultStreamName(),
            DataPublisherUtil.getApiManagerAnalyticsConfiguration().getFaultStreamVersion());
      }

      // If Throttle Stream Definition does not exist.
      if (!dataPublisher.isStreamDefinitionAdded(
          DataPublisherUtil.getApiManagerAnalyticsConfiguration().getThrottleStreamName(),
          DataPublisherUtil.getApiManagerAnalyticsConfiguration().getThrottleStreamVersion())) {

        // Get Throttle Stream Definition
        String throttleStreamDefinition = DataBridgeThrottlePublisherDTO.getStreamDefinition();

        // Add Throttle Stream Definition;
        dataPublisher.addStreamDefinition(
            throttleStreamDefinition,
            DataPublisherUtil.getApiManagerAnalyticsConfiguration().getThrottleStreamName(),
            DataPublisherUtil.getApiManagerAnalyticsConfiguration().getThrottleStreamVersion());
      }
    } catch (Exception e) {
      log.error("Error initializing APIMgtUsageDataBridgeDataPublisher", e);
    }
  }