![]() |
VOOZH | about |
dotnet add package StreamStore.NoSql.Cassandra --version 0.12.0
NuGet\Install-Package StreamStore.NoSql.Cassandra -Version 0.12.0
<PackageReference Include="StreamStore.NoSql.Cassandra" Version="0.12.0" />
<PackageVersion Include="StreamStore.NoSql.Cassandra" Version="0.12.0" />Directory.Packages.props
<PackageReference Include="StreamStore.NoSql.Cassandra" />Project file
paket add StreamStore.NoSql.Cassandra --version 0.12.0
#r "nuget: StreamStore.NoSql.Cassandra, 0.12.0"
#:package StreamStore.NoSql.Cassandra@0.12.0
#addin nuget:?package=StreamStore.NoSql.Cassandra&version=0.12.0Install as a Cake Addin
#tool nuget:?package=StreamStore.NoSql.Cassandra&version=0.12.0Install as a Cake Tool
👁 NuGet version (StreamStore.NoSql.Cassandra)
Apache Cassandra and Azure Cosmos DB for Apache Cassandra storage for StreamStore asynchronous event sourcing library built on top of CassandraCSharpDriver.
Does not support event duplication detection based on event ID due to lack of unique constraints.
Despite the fact that Apache Cassandra is not ACID compliant DBMS, library provides ACID guarantees for the operations that are performed within a single partition key - stream identifier.
Such guarantees are achieved by using following features:
LWT (Lightweight Transactions) feature of Cassandra.ALL consistency level for the read and write operations.SERIAL serial consistency level for the read operations.Taking into account that configuration above significantly affects the performance of the system, and that not all scenarios requires ACID compliance, it has been decided to add possibility to change consistency levels via configuration.
To install the package, you can use the following command from the command line:
dotnet add package StreamStore
dotnet add package StreamStore.NoSql.Cassandra
or from Nuget Package Manager Console:
Install-Package StreamStore
Install-Package StreamStore.NoSql.Cassandra
By default the library provisioning schema automatically, however you must create keyspace or configure library to use already existing one.
By default the library uses streamstore keyspace in single tenant mode.
For multitenancy mode you must create keyspace per tenant in advance.
If you want to create table manually, you can use the following script:
CREATE TABLE IF NOT EXISTS events
(id text,
stream_id text,
revision int,
timestamp timestamp,
data blob,
custom_properties map<text,text>,
PRIMARY KEY(stream_id, revision)
);
Since the library CassandraCSharpDriver as well as Apache Cassandra itself provides a lot of configuration options, it is not possible to cover all of them in the library configuration.
In this regards, decision has been made to provide ability to configure connectivity options via original
API of CassandraCSharpDriver.
However, in case if you decided to use library with Azure Cosmos DB for Apache Cassandra, there is extension simplifies configuration by only connection string required.
// Register single tenant implementation
services.UseCassandra(x => {
x.UseCosmosDb(connectionString); // Optional. Required if you want to use Azure Cosmos DB for Apache Cassandra
x.ConfigureCluster(c => // Required. Configure cluster options. Optional if you decided to use CosmosDB (see above).
c.AddContactPoint("localhost")); // Configure contact points.
}
)
// Or enable multitenancy
x.UseCassandraWithMultitenancy(
// Configure storage options
c =>
c.UseCosmosDb(connectionString) // Optional. Required if you want to use Azure Cosmos DB for Apache Cassandra
.Configureluster(x => // Required. Configure cluster options. Optional if you decided to use CosmosDB (see above).
x.AddContactPoint("localhost")), // Configure contact points.
// Configure multitenancy options
x =>
x.WithKeyspaceProvider<Provider>() // Required. Register your ITenantKeyspaceProvider implementation.
.UseTenantProvider<MyTenantProvider>(); // Optional. Register your ITenantProvider implementation.
);
Full list of configuration options you can find in the Configuration options section.
How to use StreamStore in your application code you can find on StreamStore page.
You can find an example of usage in the StreamStore.NoSql.Example project.
More information about how example application works you can find in StreamStore documentation.
In order to run tests placed in StreamStore.NoSql.Tests/Cassandra/Storage, you need to have a running Cassandra cluster. You can use docker-compose docker-compose.yaml to run it.
Below you can find the list of configuration options that can be used to configure the library.
// Register single tenant implementation
services.UseCassandra(x =>
{
x.UseCosmosDb(connectionString); // Optional. Required if you want to use Azure Cosmos DB for Apache Cassandra.
x.UseCosmosDb(Configuration, connectionStringName); // You can also provide IConfiguration and connection string name to Cosmos DB, by default "StreamStore".
x.ConfigureCluster(c => // Required. Configure cluster options. Optional if you decided to use CosmosDB (see above).
c.AddContactPoint("localhost")); // Configure contact points at least.
// There is much more cluster options available.
x.ConfigureStorage(c => // Optional. Configure storage options.
c.WithKeyspaceName("keyspacename") // Optional. Keyspace name. Default is streamstore.
.WithEventsTableName("tablename") // Optional. Table name. Default is events.
.WithReadConsistencyLevel(ConsistencyLevel.Quorum) // Optional. Read consistency level. Default is All.
.WithWriteConsistencyLevel(ConsistencyLevel.Quorum) // Optional. Write consistency level. Default is All.
.WithSerialConsistencyLevel(ConsistencyLevel.SerialLocal) // Optional. Serial consistency level. Default is Serial.
);
x.WithSessionFactory<TFactory>() // Optional. Register your ISessionFactory implementation.
}
);
// Or enable multitenancy
// More information about multitenancy configuration you can find in the StreamStore.
services.UseCassandraWithMultitenancy(
// Configure storage options, see above
c => ...,
// Configure multitenancy options
x =>
{
x.WithKeyspaceProvider<Provider>(); // Required. Register your ITenantKeyspaceProvider implementation.
x.WithTenantClusterConfigurator(c => ...); // Optional. Register delegate for configuring tenant cluster configuration based on default cluster.
x.WithStorageConfigurationProvider<TProvider>(); // Optional. Register your ITenantStorageConfigurationProvider implementation.
}
);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.