Class/Object

org.zalando.kanadi.api

Subscriptions

Related Docs: object Subscriptions | package api

Permalink

case class Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenProvider] = None)(implicit kanadiHttpConfig: HttpConfig, http: HttpExt, materializer: Materializer) extends SubscriptionsInterface with Product with Serializable

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Subscriptions
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. SubscriptionsInterface
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Subscriptions(baseUri: URI, oAuth2TokenProvider: Option[OAuth2TokenProvider] = None)(implicit kanadiHttpConfig: HttpConfig, http: HttpExt, materializer: Materializer)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addStreamToKillSwitch(subscriptionId: SubscriptionId, streamId: StreamId, uniqueKillSwitch: UniqueKillSwitch): Unit

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. val baseUri: URI

    Permalink
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def closeHttpConnection(subscriptionId: SubscriptionId, streamId: StreamId): Boolean

    Permalink

    Closes the underlying http connection for a subscriptionId/streamId.

    Closes the underlying http connection for a subscriptionId/streamId.

    returns

    true If there was a reference to a connection (i.e. there was a stream running) or false if there was no reference. Note that cancelling the http connection will execute the eventsStreamed#connectionClosedCallback

    Definition Classes
    SubscriptionsSubscriptionsInterface
  9. def commitCursors(subscriptionId: SubscriptionId, subscriptionCursor: SubscriptionCursor, streamId: StreamId, eventBatch: Boolean = true)(implicit flowId: FlowId = randomFlowId(), executionContext: ExecutionContext): Future[Option[CommitCursorResponse]]

    Permalink

    Endpoint for committing offsets of the subscription.

    Endpoint for committing offsets of the subscription. If there is uncommitted data, and no commits happen for 60 seconds, then Nakadi will consider the client to be gone, and will close the connection. As long as no events are sent, the client does not need to commit.

    If the connection is closed, the client has 60 seconds to commit the events it received, from the moment they were sent. After that, the connection will be considered closed, and it will not be possible to do commit with that X-Nakadi-StreamId anymore.

    When a batch is committed that also automatically commits all previous batches that were sent in a stream for this partition.

    subscriptionId

    Id of subscription

    streamId

    Id of stream which client uses to read events. It is not possible to make a commit for a terminated or none-existing stream. Also the client can't commit something which was not sent to his stream.

    eventBatch

    Whether it's an event batch or not (e.g. keep-alive).

    flowId

    The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.

    Definition Classes
    SubscriptionsSubscriptionsInterface
  10. def create(subscription: Subscription)(implicit flowId: FlowId = randomFlowId(), executionContext: ExecutionContext): Future[Subscription]

    Permalink

    This endpoint creates a subscription for org.zalando.kanadi.models.EventTypeName's.

    This endpoint creates a subscription for org.zalando.kanadi.models.EventTypeName's. The subscription is needed to be able to consume events from EventTypes in a high level way when Nakadi stores the offsets and manages the rebalancing of consuming clients. The subscription is identified by its key parameters (owning_application, event_types, consumer_group). If this endpoint is invoked several times with the same key subscription properties in body (order of even_types is not important) - the subscription will be created only once and for all other calls it will just return the subscription that was already created.

    subscription

    Subscription is a high level consumption unit. Subscriptions allow applications to easily scale the number of clients by managing consumed event offsets and distributing load between instances. The key properties that identify subscription are owningApplication, eventTypes and consumerGroup. It's not possible to have two different subscriptions with these properties being the same.

    flowId

    The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.

    Definition Classes
    SubscriptionsSubscriptionsInterface
  11. def createIfDoesntExist(subscription: Subscription)(implicit flowId: FlowId = randomFlowId(), executionContext: ExecutionContext): Future[Subscription]

    Permalink

    Attempts to create a subscription if it doesn't already exist, else it will return the currently existing subscription

    Attempts to create a subscription if it doesn't already exist, else it will return the currently existing subscription

    flowId

    The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.

    Definition Classes
    SubscriptionsSubscriptionsInterface
  12. def cursors(subscriptionId: SubscriptionId)(implicit flowId: FlowId = randomFlowId(), executionContext: ExecutionContext): Future[Option[SubscriptionCursor]]

    Permalink

    Exposes the currently committed offsets of a subscription.

    Exposes the currently committed offsets of a subscription.

    subscriptionId

    Id of subscription.

    flowId

    The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.

    Definition Classes
    SubscriptionsSubscriptionsInterface
  13. def delete(subscriptionId: SubscriptionId)(implicit flowId: FlowId = randomFlowId(), executionContext: ExecutionContext): Future[Unit]

    Permalink

    Deletes a subscription.

    Deletes a subscription.

    subscriptionId

    Id of subscription.

    flowId

    The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.

    Definition Classes
    SubscriptionsSubscriptionsInterface
  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def eventsStreamed[T](subscriptionId: SubscriptionId, eventCallback: EventCallback[T], connectionClosedCallback: ConnectionClosedCallback = ..., streamConfig: StreamConfig = Subscriptions.StreamConfig(), modifySourceFunction: Option[(Source[SubscriptionEvent[T], UniqueKillSwitch]) ⇒ Source[SubscriptionEvent[T], UniqueKillSwitch]] = None)(implicit decoder: Decoder[List[Event[T]]], flowId: FlowId = randomFlowId(), executionContext: ExecutionContext, eventStreamSupervisionDecider: EventStreamSupervisionDecider): Future[StreamId]

    Permalink

    Starts a new stream for reading events from this subscription.

    Starts a new stream for reading events from this subscription. The data will be automatically rebalanced between streams of one 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 rebalance currently only operates with the number of partitions so the amount of data in event-types/partitions is not considered during autorebalance. The position of the consumption is managed by Nakadi. The client is required to commit the cursors he gets in a stream.

    This call lets you register a callback which gets execute every time an event is streamed. There are different types of callbacks depending on how you want to handle failure. The timeout for the akka http request is the same as streamTimeout with a small buffer. Note that typically clients should be using eventsStreamedManaged as this will handle disconnects/reconnects

    subscriptionId

    Id of subscription.

    eventCallback

    The callback which gets executed every time an event is processed via the stream

    connectionClosedCallback

    The callback which gets executed when the connection is closed, you typically want to reopen the subscription

    streamConfig

    Configuration for the stream

    modifySourceFunction

    Allows you to specify a function which modifies the underlying stream

    flowId

    The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.

    eventStreamSupervisionDecider

    The supervision decider which decides what to do when an error is thrown in the stream. Default behaviour is if its a JSON Circe decoding exception on event data, it will commit the cursor, log the error and resume the stream, otherwise it will log the error and restart the stream.

    returns

    The StreamId for this Stream

    Definition Classes
    SubscriptionsSubscriptionsInterface
  16. def eventsStreamedManaged[T](subscriptionId: SubscriptionId, eventCallback: EventCallback[T], connectionClosedCallback: ConnectionClosedCallback = ..., streamConfig: StreamConfig = Subscriptions.StreamConfig(), modifySourceFunction: Option[(Source[SubscriptionEvent[T], UniqueKillSwitch]) ⇒ Source[SubscriptionEvent[T], UniqueKillSwitch]] = None)(implicit decoder: Decoder[List[Event[T]]], flowId: FlowId = randomFlowId(), executionContext: ExecutionContext, eventStreamSupervisionDecider: EventStreamSupervisionDecider): Future[StreamId]

    Permalink

    Creates an event stream using eventsStreamed however also manages disconnects and reconnects from the server.

    Creates an event stream using eventsStreamed however also manages disconnects and reconnects from the server. Typically clients want to use this as they don't need to handle these situations manually.

    This uses akka.pattern.after to recreate the streams in the case of server disconnects/no empty slots and cursor resets. The timeouts respectively can be configured with HttpConfig.serverDisconnectRetryDelay and HttpConfig.noEmptySlotsCursorResetRetryDelay. The connectionClosedCallback parameter is still respected.

    NOTE: If the connection is closed by the client explicitly using the closeHttpConnection method then eventsStreamedManaged will not re-establish a connection.

    subscriptionId

    Id of subscription.

    eventCallback

    The callback which gets executed every time an event is processed via the stream

    connectionClosedCallback

    The callback which gets executed when the connection is closed, you typically want to reopen the subscription. NOTE: Don't use the parameter to reconnect the stream, this is automatically handled

    streamConfig

    Configuration for the stream

    modifySourceFunction

    Allows you to specify a function which modifies the underlying stream

    flowId

    The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.

    eventStreamSupervisionDecider

    The supervision decider which decides what to do when an error is thrown in the stream. Default behaviour is if its a JSON Circe decoding exception on event data, it will commit the cursor, log the error and resume the stream, otherwise it will log the error and restart the stream.

    returns

    Initial Stream Id

    Definition Classes
    SubscriptionsSubscriptionsInterface
  17. def eventsStreamedSource[T](subscriptionId: SubscriptionId, connectionClosedCallback: ConnectionClosedCallback = ..., streamConfig: StreamConfig = Subscriptions.StreamConfig())(implicit decoder: Decoder[List[Event[T]]], flowId: FlowId, executionContext: ExecutionContext, eventStreamSupervisionDecider: EventStreamSupervisionDecider): Future[NakadiSource[T]]

    Permalink

    Starts a new stream for reading events from this subscription.

    Starts a new stream for reading events from this subscription. The data will be automatically rebalanced between streams of one 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 rebalance currently only operates with the number of partitions so the amount of data in event-types/partitions is not considered during autorebalance. The position of the consumption is managed by Nakadi. The client is required to commit the cursors he gets in a stream.

    This exposes the stream as a Source, which also means you need to handle adding the stream to the kill switch configuration using the addStreamToKillSwitch method if you plan on using the closeHttpConnection to kill a stream.

    Definition Classes
    SubscriptionsSubscriptionsInterface
  18. def eventsStreamedSourceManaged[T](subscriptionId: SubscriptionId, connectionClosedCallback: ConnectionClosedCallback = ..., streamConfig: StreamConfig = Subscriptions.StreamConfig())(implicit decoder: Decoder[List[Event[T]]], flowId: FlowId, executionContext: ExecutionContext, eventStreamSupervisionDecider: EventStreamSupervisionDecider): Future[NakadiSource[T]]

    Permalink
    Definition Classes
    SubscriptionsSubscriptionsInterface
  19. def eventsStrictUnsafe[T](subscriptionId: SubscriptionId, maxUncommittedEvents: Option[Int] = None, batchLimit: Option[Int] = None, streamLimit: Option[Int] = None, batchFlushTimeout: Option[FiniteDuration] = None, streamTimeout: Option[FiniteDuration] = None, streamKeepAliveLimit: Option[Int] = None)(implicit decoder: Decoder[List[Event[T]]], flowId: FlowId = randomFlowId(), executionContext: ExecutionContext): Future[List[SubscriptionEvent[T]]]

    Permalink

    NOTE: This is the strict version of eventsStreamed, unless you know what you are doing, you should only be using this method for debugging purposes.

    NOTE: This is the strict version of eventsStreamed, unless you know what you are doing, you should only be using this method for debugging purposes. If you don't set streamTimeout, this function will never complete, and you will likely run out of memory on your machine.

    subscriptionId

    Id of subscription.

    maxUncommittedEvents

    The amount of uncommitted events Nakadi will stream before pausing the stream. When in paused state and commit comes - the stream will resume. Minimal value is 1.

    batchLimit

    Maximum number of SubscriptionEvent's in each chunk (and therefore per partition) of the stream. If 0 or unspecified will buffer Events indefinitely and flush on reaching of batchFlushTimeout

    streamLimit

    Maximum number of SubscriptionEvent's in this stream (over all partitions being streamed in this connection). If 0 or undefined, will stream batches indefinitely. Stream initialization will fail if streamLimit is lower than batchLimit.

    batchFlushTimeout

    Maximum time in seconds to wait for the flushing of each chunk (per partition). If the amount of buffered Events reaches batchLimit before this batchFlushTimeout is reached, the messages are immediately flushed to the client and batch flush timer is reset. If 0 or undefined, will assume 30 seconds.

    streamTimeout

    Maximum time in seconds a stream will live before connection is closed by the server. If 0 or unspecified will stream indefinitely. If this timeout is reached, any pending messages (in the sense of stream_limit) will be flushed to the client. Stream initialization will fail if streamTimeout is lower than batchFlushTimeout.

    streamKeepAliveLimit

    Maximum number of empty keep alive batches to get in a row before closing the connection. If 0 or undefined will send keep alive messages indefinitely.

    flowId

    The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.

    Definition Classes
    SubscriptionsSubscriptionsInterface
  20. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  21. def get(subscriptionId: SubscriptionId)(implicit flowId: FlowId = randomFlowId(), executionContext: ExecutionContext): Future[Option[Subscription]]

    Permalink

    Returns a subscription identified by id.

    Returns a subscription identified by id.

    subscriptionId

    Id of subscription.

    flowId

    The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.

    Definition Classes
    SubscriptionsSubscriptionsInterface
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  24. def list(owningApplication: Option[String] = None, eventType: Option[List[EventTypeName]] = None, limit: Option[Int] = None, offset: Option[Int] = None)(implicit flowId: FlowId = randomFlowId(), executionContext: ExecutionContext): Future[SubscriptionQuery]

    Permalink

    Lists all subscriptions that exist in a system.

    Lists all subscriptions that exist in a system. List is ordered by creation date/time descending (newest subscriptions come first).

    owningApplication

    Parameter to filter subscriptions list by owning application. If not specified - the result list will contain subscriptions of all owning applications.

    eventType

    Parameter to filter subscriptions list by event types. If not specified - the result list will contain subscriptions for all event types. It's possible to provide multiple values like List(EventTypeName("et1"),EventTypeName("et2")), in this case it will show subscriptions having both "et1" and "et2"

    limit

    maximum number of subscriptions retuned in one page

    offset

    page offset

    flowId

    The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.

    Definition Classes
    SubscriptionsSubscriptionsInterface
  25. val logger: LoggerTakingImplicit[FlowId]

    Permalink
    Attributes
    protected
  26. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  27. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  28. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  29. val oAuth2TokenProvider: Option[OAuth2TokenProvider]

    Permalink
  30. def resetCursors(subscriptionId: SubscriptionId, subscriptionCursor: Option[SubscriptionCursor] = None)(implicit flowId: FlowId = randomFlowId(), executionContext: ExecutionContext): Future[Boolean]

    Permalink
    Definition Classes
    SubscriptionsSubscriptionsInterface
  31. def stats(subscriptionId: SubscriptionId)(implicit flowId: FlowId = randomFlowId(), executionContext: ExecutionContext): Future[Option[SubscriptionStats]]

    Permalink

    exposes statistics of specified subscription

    exposes statistics of specified subscription

    subscriptionId

    Id of subscription

    flowId

    The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.

    Definition Classes
    SubscriptionsSubscriptionsInterface
  32. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  33. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from SubscriptionsInterface

Inherited from AnyRef

Inherited from Any

Ungrouped