Struct nakadion::api::ApiClient [−][src]
pub struct ApiClient { /* fields omitted */ }
Expand description
A client to connect to the API of Nakadi
.
The actual HTTP client is pluggable via the DispatchHttpRequest
trait.
The ApiClient
does retries with exponential backoff and jitter except
for the following trait methods:
SubscriptionApi::request_stream
SubscriptionApi::commit_cursors
PublishApi::publish_events_batch
on_retry
A closure to be called before a retry. The error which caused the retry and the time until the retry will be made is passed. This closure overrides the current one and will be used for all subsequent clones of this instance. This allows users to give context on the call site.
Implementations
misleading name. builder is just the empty default. use default_builder
Get a default builder
There are also methods to get a Builder
which is initialized from the
environment:
Builder::builder_from_env
Builder::builder_from_env_prefixed
Get a builder filled from the environment
Values are filled from prefixed environment variables
Get a builder filled from the environment
Values must be prefixed with NAKADION
pub fn set_on_retry<F: Fn(&NakadiApiError, Duration) + Send + Sync + 'static>(
&mut self,
on_retry: F
)
Trait Implementations
fn get_cursor_distances<T: Into<FlowId>>(
&self,
name: &EventTypeName,
query: &[CursorDistanceQuery],
flow_id: T
) -> ApiFuture<'_, Vec<CursorDistanceResult>>
fn get_cursor_distances<T: Into<FlowId>>(
&self,
name: &EventTypeName,
query: &[CursorDistanceQuery],
flow_id: T
) -> ApiFuture<'_, Vec<CursorDistanceResult>>
Deletes an EventType identified by its name. Read more
Used when a consumer wants to know how far behind in the stream its application is lagging. Read more
fn get_event_type_partitions<T: Into<FlowId>>(
&self,
event_type: &EventTypeName,
flow_id: T
) -> ApiFuture<'_, Vec<Partition>>
fn get_event_type_partitions<T: Into<FlowId>>(
&self,
event_type: &EventTypeName,
flow_id: T
) -> ApiFuture<'_, Vec<Partition>>
Lists the Partitions for the given event-type. Read more
fn publish_events_batch<'a, B: Into<Bytes>, T: Into<FlowId>>(
&'a self,
event_type: &'a EventTypeName,
events: B,
flow_id: T
) -> PublishFuture<'a>
fn publish_events_batch<'a, B: Into<Bytes>, T: Into<FlowId>>(
&'a self,
event_type: &'a EventTypeName,
events: B,
flow_id: T
) -> PublishFuture<'a>
Publishes a batch of Events of this EventType. All items must be of the EventType identified by name. Read more
Returns a list of all registered EventTypes
See also Nakadi Manual
fn create_event_type<T: Into<FlowId>>(
&self,
event_type: &EventTypeInput,
flow_id: T
) -> ApiFuture<'_, ()>
fn create_event_type<T: Into<FlowId>>(
&self,
event_type: &EventTypeInput,
flow_id: T
) -> ApiFuture<'_, ()>
Creates a new EventType.
See also Nakadi Manual
fn delete_event_type<T: Into<FlowId>>(
&self,
name: &EventTypeName,
flow_id: T
) -> ApiFuture<'_, ()>
fn delete_event_type<T: Into<FlowId>>(
&self,
name: &EventTypeName,
flow_id: T
) -> ApiFuture<'_, ()>
Deletes an EventType identified by its name.
See also Nakadi Manual
fn get_event_type<T: Into<FlowId>>(
&self,
name: &EventTypeName,
flow_id: T
) -> ApiFuture<'_, EventType>
fn get_event_type<T: Into<FlowId>>(
&self,
name: &EventTypeName,
flow_id: T
) -> ApiFuture<'_, EventType>
Returns the EventType identified by its name. Read more
fn update_event_type<T: Into<FlowId>>(
&self,
name: &EventTypeName,
event_type: &EventType,
flow_id: T
) -> ApiFuture<'_, ()>
fn update_event_type<T: Into<FlowId>>(
&self,
name: &EventTypeName,
event_type: &EventType,
flow_id: T
) -> ApiFuture<'_, ()>
Updates the EventType identified by its name. Read more
fn create_subscription<T: Into<FlowId>>(
&self,
input: &SubscriptionInput,
flow_id: T
) -> ApiFuture<'_, Subscription>
fn create_subscription<T: Into<FlowId>>(
&self,
input: &SubscriptionInput,
flow_id: T
) -> ApiFuture<'_, Subscription>
This endpoint creates a subscription for EventTypes.
See also Nakadi Manual
fn get_subscription<T: Into<FlowId>>(
&self,
id: SubscriptionId,
flow_id: T
) -> ApiFuture<'_, Subscription>
fn get_subscription<T: Into<FlowId>>(
&self,
id: SubscriptionId,
flow_id: T
) -> ApiFuture<'_, Subscription>
Returns a subscription identified by id.
See also Nakadi Manual
fn update_auth<T: Into<FlowId>>(
&self,
input: &SubscriptionInput,
flow_id: T
) -> ApiFuture<'_, ()>
fn update_auth<T: Into<FlowId>>(
&self,
input: &SubscriptionInput,
flow_id: T
) -> ApiFuture<'_, ()>
This endpoint only allows to update the authorization section of a subscription.
All other properties are immutable. This operation is restricted to subjects with administrative role. This call captures the timestamp of the update request.
See also Nakadi Manual
fn delete_subscription<T: Into<FlowId>>(
&self,
id: SubscriptionId,
flow_id: T
) -> ApiFuture<'_, ()>
fn delete_subscription<T: Into<FlowId>>(
&self,
id: SubscriptionId,
flow_id: T
) -> ApiFuture<'_, ()>
Deletes a subscription.
See also Nakadi Manual
fn get_subscription_cursors<T: Into<FlowId>>(
&self,
id: SubscriptionId,
flow_id: T
) -> ApiFuture<'_, Vec<SubscriptionCursor>>
fn get_subscription_cursors<T: Into<FlowId>>(
&self,
id: SubscriptionId,
flow_id: T
) -> ApiFuture<'_, Vec<SubscriptionCursor>>
Exposes the currently committed offsets of a subscription.
See also Nakadi Manual
fn reset_subscription_cursors<T: Into<FlowId>>(
&self,
id: SubscriptionId,
cursors: &[EventTypeCursor],
flow_id: T
) -> ApiFuture<'_, ()>
fn reset_subscription_cursors<T: Into<FlowId>>(
&self,
id: SubscriptionId,
cursors: &[EventTypeCursor],
flow_id: T
) -> ApiFuture<'_, ()>
Reset subscription offsets to specified values.
See also Nakadi Manual
fn list_subscriptions<T: Into<FlowId>>(
&self,
event_type: Option<&EventTypeName>,
owning_application: Option<&OwningApplication>,
limit: Option<usize>,
offset: Option<usize>,
show_status: bool,
flow_id: T
) -> BoxStream<'static, Result<Subscription, NakadiApiError>>
fn list_subscriptions<T: Into<FlowId>>(
&self,
event_type: Option<&EventTypeName>,
owning_application: Option<&OwningApplication>,
limit: Option<usize>,
offset: Option<usize>,
show_status: bool,
flow_id: T
) -> BoxStream<'static, Result<Subscription, NakadiApiError>>
Lists all subscriptions that exist in a system. Read more
fn get_subscription_stats<T: Into<FlowId>>(
&self,
id: SubscriptionId,
show_time_lag: bool,
flow_id: T
) -> ApiFuture<'_, SubscriptionStats>
fn get_subscription_stats<T: Into<FlowId>>(
&self,
id: SubscriptionId,
show_time_lag: bool,
flow_id: T
) -> ApiFuture<'_, SubscriptionStats>
Exposes statistics of specified subscription. Read more
fn commit_cursors<T: Into<FlowId>>(
&self,
id: SubscriptionId,
stream: StreamId,
cursors: &[SubscriptionCursor],
flow_id: T
) -> ApiFuture<'_, CursorCommitResults>
fn commit_cursors<T: Into<FlowId>>(
&self,
id: SubscriptionId,
stream: StreamId,
cursors: &[SubscriptionCursor],
flow_id: T
) -> ApiFuture<'_, CursorCommitResults>
Endpoint for committing offsets of the subscription. Read more
fn request_stream<'a, T: Into<FlowId>>(
&'a self,
subscription_id: SubscriptionId,
parameters: &StreamParameters,
flow_id: T
) -> ApiFuture<'a, SubscriptionStreamChunks>
fn request_stream<'a, T: Into<FlowId>>(
&'a self,
subscription_id: SubscriptionId,
parameters: &StreamParameters,
flow_id: T
) -> ApiFuture<'a, SubscriptionStreamChunks>
Starts a new stream for reading events from this subscription. Read more
Auto Trait Implementations
impl !RefUnwindSafe for ApiClient
impl !UnwindSafe for ApiClient
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn reset_cursors_to_begin<T>(
&Self,
SubscriptionId,
T
) -> Pin<Box<dyn Future<Output = Result<(), NakadiApiError>> + Send, Global>> where
T: Into<FlowId>,
pub fn reset_cursors_to_begin<T>(
&Self,
SubscriptionId,
T
) -> Pin<Box<dyn Future<Output = Result<(), NakadiApiError>> + Send, Global>> where
T: Into<FlowId>,
Resets all cursors of the given subscription to CursorOffset::Begin
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more