eventstore_client 0.7.1 eventstore_client: ^0.7.1 copied to clipboard
A community developed gRPC client library for EventStoreDB. EventStoreDB is an open-source, functional database with Complex Event Processing capabilities.
Client examples #
These code examples are best practice usage of the client
Connecting to EventStoreDB #
The preferred way of configuring a client is by using a connection string. In most cases, you would need to configure a secure connection. The following example show how to create a EventStoreStreamsClient with a connection string:
final settings = EventStoreClientSettings.parse('{connectionString}');
final streamsClient = EventStoreStreamsClient(settings);
The same pattern applies for all clients. These are examples of connection strings that all Dart clients support:
// Single node
EventStoreClientSettings.parse("esdb://localhost"); // with hostname only
EventStoreClientSettings.parse("esdb://localhost:2113"); // with hostname and port
EventStoreClientSettings.parse("esdb://user:pass@localhost:2113"); // with username and password
EventStoreClientSettings.parse("esdb://user:pass@localhost:2113/"); // extra forward slash also works
EventStoreClientSettings.parse("esdb://user:pass@localhost:2113?tlsVerifyCert=false"); // disables server certificate validation
EventStoreClientSettings.parse("esdb://user:pass@localhost:2113?tls=false"); // connects over http instead of https
// Cluster
EventStoreClientSettings.parse("esdb://host1,host2,host3"); // with hostnames only
EventStoreClientSettings.parse("esdb://host1:1234,host2:4321,host3:3231"); // with hostnames and port
EventStoreClientSettings.parse("esdb://user:pass@host1:1234,host2:4321,host3:3231?nodePreference=follower"); // with username and password
EventStoreClientSettings.parse("esdb://host1,host2,host3?tls=false"); // connects over http instead of https
EventStoreClientSettings.parse("esdb://host1,host2,host3?tlsVerifyCert=false"); // disables server certificate validation
The following clients are available
- EventStoreStreamsClient - for working with streams
- EventStoreProjectionsClient - for working with projections
- EventStorePersistentSubscriptionsClient - for working with persistent subscriptions
- EventStoreGossipClient - for inspecting server nodes using the gossip protocol
- EventStoreUsersClient - for working with internal users
- EventStoreMonitoringClient - for fetching statistics from nodes
See official documentation for more information about connections to EventStoreDB.
Working with Streams #
The EventStoreStreamsClient is the primary client for working with streams in EventStoreDB. The following examples show how you should use it:
- Append to a stream
- Read from $all stream
- Read from a stream
- Subscribe to $all stream
- Subscribe to $all with filter
- Subscribe to $all with callback
- Subscribe to $all with retry
- Subscribe to a stream
- Subscribe to a stream with callback
Working with Projections #
The EventStoreProjectionsClient is the primary client for working with projections in EventStoreDB. The following example show how you should use it:
- TDB
Working with Persistent subscriptions #
The EventStorePersistentSubscriptionsClient is the primary client for working with persistent projections in EventStoreDB. The following example show how you should use it:
- TDB