Closes the underlying http connection for a subscriptionId/streamId.
Closes the underlying http connection for a subscriptionId/streamId.
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
Endpoint for committing offsets of the subscription.
Endpoint for committing offsets of the subscription. If there is uncommited 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.
Id of subscription
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.
The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.
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 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.
The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.
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
The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.
Exposes the currently committed offsets of a subscription.
Exposes the currently committed offsets of a subscription.
Id of subscription.
The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.
Deletes a subscription.
Deletes a subscription.
Id of subscription.
The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.
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
Id of subscription.
The callback which gets executed every time an event is processed via the stream
The callback which gets executed when the connection is closed, you typically want to reopen the subscription
Configuration for the stream
Allows you to specify a function which modifies the underlying stream
The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.
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.
The StreamId for this Stream
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.
Id of subscription.
The callback which gets executed every time an event is processed via the stream
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
Configuration for the stream
Allows you to specify a function which modifies the underlying stream
The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.
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.
Initial Stream Id
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.
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.
Id of subscription.
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.
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
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.
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.
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.
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.
The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.
Returns a subscription identified by id.
Returns a subscription identified by id.
Id of subscription.
The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.
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).
Parameter to filter subscriptions list by owning application. If not specified - the result list will contain subscriptions of all owning applications.
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"
maximum number of subscriptions retuned in one page
page offset
The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.
exposes statistics of specified subscription
exposes statistics of specified subscription
Id of subscription
The flow id of the request, which is written into the logs and passed to called services. Helpful for operational troubleshooting and log analysis.