Package org.zalando.fahrschein
Class NakadiClient
- java.lang.Object
-
- org.zalando.fahrschein.NakadiClient
-
public class NakadiClient extends Object
General implementation of the Nakadi Client used within this Library.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static NakadiClientBuilderbuilder(URI baseUri, org.zalando.fahrschein.http.api.RequestFactory requestFactory)Returns a new Builder that will make use of the givenRequestFactory.voiddeleteSubscription(String subscriptionId)Delete subscription based on subscription ID.List<Partition>getPartitions(String eventName)Resolves a list of partitions for the given eventName.<T> voidpublish(String eventName, List<T> events)Writes the given events to the endpoint provided by the eventName.StreamBuilder.LowLevelStreamBuilderstream(String eventName)StreamBuilder.SubscriptionStreamBuilderstream(Subscription subscription)Subscriptionsubscribe(String applicationName, String eventName, String consumerGroup)Deprecated.Use theSubscriptionBuilderandsubscription(String, String)instead.SubscriptionBuildersubscription(String applicationName, String eventName)Build a subscription for a single event type.SubscriptionBuildersubscription(String applicationName, Set<String> eventNames)Build a subscription for multiple event types.
-
-
-
Method Detail
-
builder
public static NakadiClientBuilder builder(URI baseUri, org.zalando.fahrschein.http.api.RequestFactory requestFactory)
Returns a new Builder that will make use of the givenRequestFactory.- Parameters:
baseUri- that we will send requests torequestFactory- that we use for the execution of our HTTP Requests.- Returns:
- A builder to initialize the client. Can be further modified later.
-
getPartitions
public List<Partition> getPartitions(String eventName) throws IOException
Resolves a list of partitions for the given eventName.- Parameters:
eventName- that we want to resolve the partitions for.- Returns:
List<Partition>ornullin- Throws:
IOException- in case of network issues.
-
publish
public <T> void publish(String eventName, List<T> events) throws EventPublishingException, 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 toevents- that should be written- Throws:
IOException- in case we fail to reach NakadiEventPublishingException- In case Nakadi returns an Erroneous response
-
subscribe
@Deprecated public Subscription subscribe(String applicationName, String eventName, String consumerGroup) throws IOException
Deprecated.Use theSubscriptionBuilderandsubscription(String, String)instead.Create a subscription for a single event type.- Throws:
IOException
-
subscription
public SubscriptionBuilder subscription(String applicationName, String eventName) throws IOException
Build a subscription for a single event type.- Throws:
IOException
-
subscription
public SubscriptionBuilder subscription(String applicationName, Set<String> eventNames) throws IOException
Build a subscription for multiple event types.- Throws:
IOException
-
deleteSubscription
public void deleteSubscription(String subscriptionId) throws IOException
Delete subscription based on subscription ID.- Throws:
IOException
-
stream
public StreamBuilder.SubscriptionStreamBuilder stream(Subscription subscription)
-
stream
public StreamBuilder.LowLevelStreamBuilder stream(String eventName)
-
-