[][src]Trait nakadion::api::SubscriptionApi

pub trait SubscriptionApi {
    fn create_subscription<T: Into<FlowId>>(
        &self,
        input: &SubscriptionInput,
        flow_id: T
    ) -> ApiFuture<Subscription>;
fn get_subscription<T: Into<FlowId>>(
        &self,
        id: SubscriptionId,
        flow_id: T
    ) -> ApiFuture<Subscription>;
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 update_auth<T: Into<FlowId>>(
        &self,
        input: &SubscriptionInput,
        flow_id: T
    ) -> ApiFuture<()>;
fn delete_subscription<T: Into<FlowId>>(
        &self,
        id: SubscriptionId,
        flow_id: T
    ) -> ApiFuture<()>;
fn get_subscription_cursors<T: Into<FlowId>>(
        &self,
        id: SubscriptionId,
        flow_id: T
    ) -> ApiFuture<Vec<SubscriptionCursor>>;
fn get_subscription_stats<T: Into<FlowId>>(
        &self,
        id: SubscriptionId,
        show_time_lag: bool,
        flow_id: T
    ) -> ApiFuture<SubscriptionStats>;
fn reset_subscription_cursors<T: Into<FlowId>>(
        &self,
        id: SubscriptionId,
        cursors: &[SubscriptionCursorWithoutToken],
        flow_id: T
    ) -> ApiFuture<()>;
fn request_stream<T: Into<FlowId>>(
        &self,
        subscription_id: SubscriptionId,
        parameters: &StreamParameters,
        flow_id: T
    ) -> ApiFuture<SubscriptionStreamChunks>;
fn commit_cursors<T: Into<FlowId>>(
        &self,
        id: SubscriptionId,
        stream: StreamId,
        cursors: &[SubscriptionCursor],
        flow_id: T
    ) -> ApiFuture<CursorCommitResults>; }

Required methods

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>

Returns a subscription identified by id.

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>>

Lists all subscriptions that exist in a system.

List is ordered by creation date/time descending (newest subscriptions come first).

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<()>

Deletes a subscription.

See also Nakadi Manual

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 get_subscription_stats<T: Into<FlowId>>(
    &self,
    id: SubscriptionId,
    show_time_lag: bool,
    flow_id: T
) -> ApiFuture<SubscriptionStats>

Exposes statistics of specified subscription.

See also Nakadi Manual

fn reset_subscription_cursors<T: Into<FlowId>>(
    &self,
    id: SubscriptionId,
    cursors: &[SubscriptionCursorWithoutToken],
    flow_id: T
) -> ApiFuture<()>

Reset subscription offsets to specified values.

See also Nakadi Manual

fn request_stream<T: Into<FlowId>>(
    &self,
    subscription_id: SubscriptionId,
    parameters: &StreamParameters,
    flow_id: T
) -> ApiFuture<SubscriptionStreamChunks>

Starts a new stream for reading events from this subscription.

Starts a new stream for reading events from this subscription. The minimal consumption unit is a partition, so it is possible to start as many streams as the total number of partitions in event-types of this subscription. The position of the consumption is managed by Nakadi. The client is required to commit the cursors he gets in a stream.

If you create a stream without specifying the partitions to read from - Nakadi will automatically assign partitions to this new stream. By default Nakadi distributes partitions among clients trying to give an equal number of partitions to each client (the amount of data is not considered). This is default and the most common way to use streaming endpoint.

It is also possible to directly request specific partitions to be delivered within the stream. If these partitions are already consumed by another stream of this subscription - Nakadi will trigger a rebalance that will assign these partitions to the new stream. The request will fail if user directly requests partitions that are already requested directly by another active stream of this subscription. The overall picture will be the following: streams which directly requested specific partitions will consume from them; streams that didn’t specify which partitions to consume will consume partitions that left - Nakadi will autobalance free partitions among these streams (balancing happens by number of partitions).

Specifying partitions to consume is not a trivial way to consume as it will require additional coordination effort from the client application, that’s why it should only be used if such way of consumption should be implemented due to some specific requirements.

Also, when using streams with directly assigned partitions, it is the user’s responsibility to detect, and react to, changes in the number of partitions in the subscription (following the re-partitioning of an event type). Using the GET /subscriptions/{subscription_id}/stats endpoint can be helpful.

See also Nakadi Manual

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.

See also Nakadi Manual

Loading content...

Implementors

impl SubscriptionApi for ApiClient[src]

fn create_subscription<T: Into<FlowId>>(
    &self,
    input: &SubscriptionInput,
    flow_id: T
) -> ApiFuture<Subscription>
[src]

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>
[src]

Returns a subscription identified by id.

See also Nakadi Manual

fn update_auth<T: Into<FlowId>>(
    &self,
    input: &SubscriptionInput,
    flow_id: T
) -> ApiFuture<()>
[src]

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<()>
[src]

Deletes a subscription.

See also Nakadi Manual

fn get_subscription_cursors<T: Into<FlowId>>(
    &self,
    id: SubscriptionId,
    flow_id: T
) -> ApiFuture<Vec<SubscriptionCursor>>
[src]

Exposes the currently committed offsets of a subscription.

See also Nakadi Manual

fn reset_subscription_cursors<T: Into<FlowId>>(
    &self,
    id: SubscriptionId,
    cursors: &[SubscriptionCursorWithoutToken],
    flow_id: T
) -> ApiFuture<()>
[src]

Reset subscription offsets to specified values.

See also Nakadi Manual

Loading content...