Class NakadiClient


  • public class NakadiClient
    extends java.lang.Object
    General implementation of the Nakadi Client used within this Library.
    • Method Detail

      • builder

        public static NakadiClientBuilder builder​(java.net.URI baseUri,
                                                  org.zalando.fahrschein.http.api.RequestFactory requestFactory)
        Returns a new Builder that will make use of the given RequestFactory.
        Parameters:
        baseUri - that we will send requests to
        requestFactory - that we use for the execution of our HTTP Requests.
        Returns:
        A builder to initialize the client. Can be further modified later.
      • getPartitions

        public java.util.List<Partition> getPartitions​(java.lang.String eventName)
                                                throws java.io.IOException
        Resolves a list of partitions for the given eventName.
        Parameters:
        eventName - that we want to resolve the partitions for.
        Returns:
        List<Partition> or null in
        Throws:
        java.io.IOException - in case of network issues.
      • publish

        public <T> void publish​(java.lang.String eventName,
                                java.util.List<T> events)
                         throws EventPublishingException,
                                java.io.IOException
        Writes the given events to the endpoint provided by the eventName.
        Type Parameters:
        T - Type of the Event
        Parameters:
        eventName - where the event should be written to
        events - that should be written
        Throws:
        java.io.IOException - in case we fail to reach Nakadi
        EventPublishingException - In case Nakadi returns an Erroneous response
      • subscribe

        @Deprecated
        public Subscription subscribe​(java.lang.String applicationName,
                                      java.lang.String eventName,
                                      java.lang.String consumerGroup)
                               throws java.io.IOException
        Deprecated.
        Create a subscription for a single event type.
        Throws:
        java.io.IOException
      • subscription

        public SubscriptionBuilder subscription​(java.lang.String applicationName,
                                                java.lang.String eventName)
                                         throws java.io.IOException
        Build a subscription for a single event type.
        Throws:
        java.io.IOException
      • subscription

        public SubscriptionBuilder subscription​(java.lang.String applicationName,
                                                java.util.Set<java.lang.String> eventNames)
                                         throws java.io.IOException
        Build a subscription for multiple event types.
        Throws:
        java.io.IOException
      • deleteSubscription

        public void deleteSubscription​(java.lang.String subscriptionId)
                                throws java.io.IOException
        Delete subscription based on subscription ID.
        Throws:
        java.io.IOException