Struct nakadion::NakadiClient
[−]
[src]
pub struct NakadiClient<C: NakadiConnector> { /* fields omitted */ }
The client to consume events from Nakadi
Methods
impl<C: NakadiConnector> NakadiClient<C>
[src]
fn new<H: Handler + 'static>(
subscription_id: SubscriptionId,
connector: Arc<C>,
handler: H,
settings: WorkerSettings
) -> Result<(Self, JoinHandle<()>), String>
subscription_id: SubscriptionId,
connector: Arc<C>,
handler: H,
settings: WorkerSettings
) -> Result<(Self, JoinHandle<()>), String>
Creates a new instance. The returned JoinHandle
can
be used to synchronize with the underlying worker.
The underlying worker will be stopped once the client is dropped.
fn from_env_with_subscription<H: Handler + 'static, T: ProvidesToken>(
subscription_id: SubscriptionId,
handler: H,
token_provider: T
) -> Result<(NakadiClient<HyperClientConnector>, JoinHandle<()>), String>
subscription_id: SubscriptionId,
handler: H,
token_provider: T
) -> Result<(NakadiClient<HyperClientConnector>, JoinHandle<()>), String>
Configure the client from environment variables.
The SubscriptionId
is provided manually. Useful if you want to consume
multiple subscriptions but want to use the same settings everywhere else.
fn from_env<H: Handler + 'static, T: ProvidesToken>(
handler: H,
token_provider: T
) -> Result<(NakadiClient<HyperClientConnector>, JoinHandle<()>), String>
handler: H,
token_provider: T
) -> Result<(NakadiClient<HyperClientConnector>, JoinHandle<()>), String>
Configure the client solely from environment variables.
Including the SubscriptionId
.
fn connector(&self) -> &C
Get access to the underlying NakadiConnector
.
Trait Implementations
impl<C: NakadiConnector> Worker for NakadiClient<C>
[src]
fn is_running(&self) -> bool
Returns true if the underlying NakadiWorker
is still running.
fn stop(&self)
Stop the underlying NakadiWorker
.
fn subscription_id(&self) -> &SubscriptionId
Return the SubscriptionId
this NakadiClient
is listening to.