Configuration
Overview
By default, Cronus and its sub-components have good default settings. However, not everything can be auto-configured, such as connection strings to databases or endpoints to various services.
Cronus
Name | Type | Required | Default Value |
---|---|---|---|
Cronus:BoundedContext | string | yes | |
Cronus:Tenants | string[] | yes | |
Cronus:ApplicationServicesEnabled | bool | no | true |
Cronus:ProjectionsEnabled | bool | no | true |
Cronus:PortsEnabled | bool | no | true |
Cronus:SagasEnabled | bool | no | true |
Cronus:GatewaysEnabled | bool | no | true |
Cronus:BoundedContext
Cronus uses this setting to personalize your application. This setting is used for naming the following components:
- RabbiMQ exchange and queue names
- Cassandra EventStore names
- Cassandra Projection store names
Allowed Characters: Cronus:BoundedContext
must be an alphanumeric character or underscore only: ^\b([\w\d_]+$)
'
Cronus:Tenants
List of tenants allowed to use the system. Cronus is designed with multitenancy in mind from the beginning and requires at least one tenant to be configured in order to work properly. The multitenancy aspects are applied to many components and to give you a feel about this here is an incomplete list of different parts of the system using this setting:
- Message - every message which is sent through Cronus is bound to a specific tenant
- RabbitMQ exchanges and queues are tenant-aware
- Event Store - every tenant has a separate storage
- Projection Store - every tenant has a separate storage
Each value you provide in the array is converted and used further to lower.
Allowed Characters: Cronus:Tenants
must be an alphanumeric character or underscore only: ^\b([\w\d_]+$)
'
Example value: ["tenant1","tenant2","tenant3"]
Once set you could use TenantsOptions
object via Dependency Injection for other purposes.
Cronus:ApplicationServicesEnabled
Specifies whether to start a consumer for the Application Services
Cronus:ProjectionsEnabled
Specifies whether to start a consumer for the Projections
Cronus:PortsEnabled
Specifies whether to start a consumer for the Ports
Cronus:SagasEnabled
Specifies whether to start a consumer for the Sagas
Cronus:GatewaysEnabled
Specifies whether to start a consumer for the Gateways
Cronus.Api
Name | Type | Required | Default Value |
---|---|---|---|
Cronus:Api:Kestrel | configurationSection | no | |
Cronus:Api:JwtAuthentication | configurationSection | no |
Hosting
The API is hosted with Kestrel.
By default, the API is hosted on port 7477
.
A configuration could be provided by KestrelOptions. You can supply them directly in the DI or through a configuration file.
Cronus:Api:Kestrel
{
"Cronus": {
"Api": {
"Kestrel": {
"Endpoints": {
"Https": {
"Url": "https://*:7477",
"Certificate": {
"Subject": "*.example.com",
"Store": "My",
"Location": "CurrentUser",
"AllowInvalid": "true"
}
}
}
}
}
}
}
Authentication
The API could be protected using a JWT bearer authentication.
The configuration is provided by JwtBearerOptions. You can supply them directly in the DI or through a configuration file.
Cronus:Api:JwtAuthentication
{
"Cronus": {
"Api": {
"JwtAuthentication": {
"Authority": "https://example.com",
"Audience": "https://example.com/resources"
}
}
}
}
Remarks: https://stackoverflow.com/a/58736850/224667
Cronus.Persistence.Cassandra
Name | Type | Required | Default Value |
---|---|---|---|
Cronus:Persistence:Cassandra:ConnectionString | string | yes | |
Cronus:Persistence:Cassandra:ReplicationStrategy | string | no | simple |
Cronus:Persistence:Cassandra:ReplicationFactor | int | no | 1 |
Cronus:Persistence:Cassandra:Datacenters | string[] | no |
Cronus:Persistence:Cassandra:ConnectionString
The connection to the Cassandra database server
Cronus:Persistence:Cassandra:ReplicationStrategy
Configures Cassandra replication strategy. This setting has effect only in the first run when creating the database.
Valid values:
- simple
- network_topology - when using this setting you need to specify
Cronus:Persistence:Cassandra:ReplicationFactor
andCronus:Persistence:Cassandra:Datacenters
as well
Cronus.Projections.Cassandra
Name | Type | Required | Default Value |
---|---|---|---|
Cronus:Projections:Cassandra:ConnectionString | string | yes | |
Cronus:Pojections:Cassandra:ReplicationStrategy | string | no | simple |
Cronus:Pojections:Cassandra:ReplicationFactor | int | no | 1 |
Cronus:Pojections:Cassandra:Datacenters | string[] | no | |
Cronus:Pojections:Cassandra:TableRetention:DeleteOldProjectionTables | boolean | no | true |
Cronus:Projections:Cassandra:TableRetention:NumberOfOldProjectionTablesToRetain | uint | no | 2 |
Cronus:Projections:Cassandra:ConnectionString
The connection to the Cassandra database server
Cronus:Projections:Cassandra:ReplicationStrategy
Configures Cassandra replication strategy. This setting has effect only in the first run when creating the database.
Valid values:
- simple
- network_topology - when using this setting you need to specify
Cronus:Projections:Cassandra:ReplicationFactor
andCronus:Projections:Cassandra:Datacenters
as well
Cronus:Projections:Cassandra:ReplicationFactor
Cronus:Projections:Cassandra:Datacenters
Cronus:Projections:Cassandra:TableRetention:DeleteOldProjectionTables
Enables deletion of old projection tables
Cronus:Projections:Cassandra:TableRetention:NumberOfOldProjectionTablesToRetain
Configures Cassandra number of old projection tables -> default: live table and 2 old tables
Cronus.Transport.RabbitMq
Cronus:Transport:RabbiMQ:ConsumerWorkersCount
>> integer | Required: Yes | Default: 5
Configures the number of threads which will be dedicated to consuming messages from RabbitMQ for every consumer.
Cronus:Transport:RabbiMQ:Server
>> string | Required: Yes | Default: 127.0.0.1
DNS or IP to the RabbitMQ server
Cronus:Transport:RabbiMQ:Port
>> integer | Required: Yes | Default: 5672
The port number on which the RabbitMQ server is running
Cronus:Transport:RabbiMQ:VHost
>> string | Required: Yes | Default: /
The name of the virtual host. It is a good practice to not use the default /
vhost. For more details see the official docs. Cronus is not using this for managing multitenancy.
Cronus:Transport:RabbiMQ:Username
>> string | Required: Yes | Default: guest
The RabbitMQ username
Cronus:Transport:RabbiMQ:Password
>> string | Required: Yes | Default: guest
The RabbitMQ password
Cronus:Transport:RabbiMQ:AdminPort
>> integer | Required: Yes | Default: 5672
RabbitMQ admin port used to create, delete rabbitmq resources
Cronus.AtomicAction.Redis
An implementation of Cronus.AtomicAction
using distributed locks with Redis
(Source: https://redis.io/topics/distlock)
Cronus:AtomicAction:Redis:ConnectionString
>> string | Required: Yes
Configures the connection string where Redis is located