Crate nakadion [−] [src]
Nakadion
A client for the Nakadi Event Broker.
Nakadion uses the Subscription API of Nakadi.
Consuming
Nakadion supports two modes of consuming events. A sequuential one and a cuncurrent one.
Sequential Consumption
In this mode Nakadion will read a batch from Nakadi then call a handler on theese and afterwards try to commit the batch. This mode of operation is simple, straight forward and should be sufficient for most scenarios. No batches are buffered when consuming sequentially.
Concurrent Consumption
DO NOT USE FOR NOW
Configuration
Nakadion is configured by environment variables.
The environment variable NAKADION_SUBSCRIPTION_ID
can be used to specify a subscription.
The value can also be passed when creating the NakadiClient
in case you want to cionsume multiple subscriptions.
Setting up the connector
NAKADION_NAKADI_HOST
: SeeConnectorSettings::nakadi_host
NAKADION_MAX_UNCOMMITED_EVENTS
: SeeConnectorSettings::max_uncommitted_events
NAKADION_BATCH_LIMIT
: SeeConnectorSettings::batch_limit
NAKADION_BATCH_FLUSH_TIMEOUT_SECS
: SeeConnectorSettings::batch_flush_timeout
NAKADION_STREAM_TIMEOUT_SECS
: SeeConnectorSettings::stream_timeout
NAKADION_STREAM_LIMIT
: SeeConnectorSettings::stream_limit
NAKADION_STREAM_KEEP_ALIVE_LIMIT
: SeeConnectorSettings::stream_keep_alive_limit
Setting up the Sequential Worker
Just set NAKADION_USE_CONCURRENT_WORKER
to false
which is also the default.
Setting up the Concurent Worker:
Just set NAKADION_USE_CONCURRENT_WORKER
to true
.
Configure the worker:
NAKADION_MAX_WORKERS
: SeeConcurrentWorkerSettings::max_workers
NAKADION_WORKER_BUFFER_SIZE
: SeeConcurrentWorkerSettings::worker_buffer_size
In this mode Nakadion will spawn a number of worker threads
and distribute work among them based on
the partion id
of a batch. The workers are not dedidacted to a partition.
Work is rather distributed based on a hash of the partition id
.
Performance
This library is not meant to be used in a high performance scenario. It uses synchronous IO.
Documentation
Documenatation can be found at docs.rs
License
Nakadion is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.#![recursion_limit = "1024"]
Modules
metrics | |
worker |
The components to consume from the stream. |
Structs
BatchInfo |
Information on a current batch. This might be
useful for a |
ClientError |
The Error type. |
ConnectorSettings |
Settings for establishing a connection to |
ConnectorSettingsBuilder |
Builder for |
Cursor |
A |
EventType |
The |
EventTypeInfo |
An |
HyperClientConnector |
A |
NakadiClient |
The client to consume events from |
PartitionId |
A partition id that comes with a |
PartitionInfo |
Information on a partition |
StreamId |
A |
StreamInfo |
A stream can provide multiple |
SubscriptionId |
A |
Token |
A token used for authentication against |
TokenError |
The Error type. |
Enums
AfterBatchAction |
Describes what to do after a batch has been processed. |
ClientErrorKind |
The kind of an error. |
TokenErrorKind |
The kind of an error. |
Traits
Checkpoints |
Checkpoints cursors |
ClientResultExt |
Additional methods for |
Handler |
Handles batches of events received from |
NakadiConnector |
Connects to |
ProvidesStreamInfo | |
ProvidesToken |
Provides a |
ReadsStream |
Connects to |
TokenResultExt |
Additional methods for |
Type Definitions
ClientResult |
Convenient wrapper around |
TokenResult |
Convenient wrapper around |