Interface EventPublishingHandler


public interface EventPublishingHandler
Interface that offers a way to add additional features around the NakadiClient. As the methods of this class are invoked on every publish request, we shouldn't - do heavy computations as it might affect performance significantly - do modification of requests
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method is invoked after the publishing of events has happened, regardless if an error occurred during publishing or not.
    <T> void
    onError(List<T> events, Throwable t)
    Invoked when publishing of events failed, before afterPublish.
    <T> void
    onPublish(String eventName, List<T> events)
    This method is called by the NakadiClient when a request towards Nakadi is going to be sent.
  • Method Details

    • onPublish

      <T> void onPublish(String eventName, List<T> events)
      This method is called by the NakadiClient when a request towards Nakadi is going to be sent. For example, it can be used to record things before that. Every EventPublishingHandler implementation is responsible for catching and logging exceptions happening in this method.
      Type Parameters:
      T - type of events that we publish
      Parameters:
      eventName - that is used for the published events
      events - that are published
    • afterPublish

      void afterPublish()
      This method is invoked after the publishing of events has happened, regardless if an error occurred during publishing or not. Every EventPublishingHandler implementation is responsible for catching and logging exceptions happening in this method.
    • onError

      <T> void onError(List<T> events, Throwable t)
      Invoked when publishing of events failed, before afterPublish. Every EventPublishingHandler implementation is responsible for catching and logging exceptions happening in this method.
      Type Parameters:
      T - type of events that we publish
      Parameters:
      events - original list of events that we tried to publish
      t - the throwable we experienced while publishing