Skip to content

Commit 2b69931

Browse files
authored
Merge pull request #2576 from Cratis:feature/read-models
Up and running with the ability to get read model instances as collection and project multiple events not bound to an event source id
2 parents 3c9f8e2 + 80a30eb commit 2b69931

File tree

24 files changed

+452
-16
lines changed

24 files changed

+452
-16
lines changed

.github/workflows/dotnet-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ jobs:
116116
- 'for_JobsManager'
117117
- 'for_Reactors'
118118
- 'for_Reducers'
119+
- 'for_ReadModels'
119120
- 'for_Webhooks'
120121
- 'Jobs'
121122
- 'Projections'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Aggregate Root
2+
3+
Documentation for aggregate root patterns.
4+
5+
TODO: Add content.

Documentation/clients/dotnet/connection-strings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ var options = new ChronicleOptions
309309
};
310310
```
311311

312-
See the [TLS Configuration](../../tls-configuration.md) documentation for more details on certificate setup.
312+
See the [TLS Configuration](../../tls-hosting/configuration.md) documentation for more details on certificate setup.
313313

314314
## Best Practices
315315

@@ -378,6 +378,6 @@ If you encounter TLS errors:
378378

379379
## See Also
380380

381-
- [TLS Configuration](../../tls-configuration.md)
381+
- [TLS Configuration](../../tls-hosting/configuration.md)
382382
- [Namespaces](namespaces.md)
383383
- [Getting Started](../../get-started/index.md)

Documentation/hosting/encryption-certificate.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Ensure you have configured the certificate path and password as described above.
192192

193193
## Next Steps
194194

195-
- [Local Certificates](local-certificates.md) - TLS certificate setup for development
196-
- [Production Hosting](production.md) - Production deployment requirements
197-
- [Configuration](configuration.md) - Complete configuration reference
195+
- [Local Certificates](hosting/local-certificates.md) - TLS certificate setup for development
196+
- [Production Hosting](hosting/production.md) - Production deployment requirements
197+
- [Configuration](hosting/configuration.md) - Complete configuration reference
198198

Documentation/hosting/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Chronicle provides multiple deployment options to suit different environments an
44

55
## Deployment Options
66

7-
- **[Production](production.md)** - Docker-based production deployment with MongoDB
8-
- **[Configuration](configuration.md)** - Complete configuration reference
9-
- **[Local Certificates](local-certificates.md)** - Generate and configure TLS certificates for local development
7+
- **[Production](hosting/production.md)** - Docker-based production deployment with MongoDB
8+
- **[Configuration](hosting/configuration.md)** - Complete configuration reference
9+
- **[Local Certificates](hosting/local-certificates.md)** - Generate and configure TLS certificates for local development
1010
- **Development** - Local development setup with MongoDB
1111
- **Docker Compose** - Multi-container setup for development and testing
1212

@@ -17,7 +17,7 @@ All Chronicle hosting environments require:
1717
- **.NET 9 Runtime** - Chronicle is built on .NET 9
1818
- **MongoDB** - Primary storage backend for events and projections
1919
- **Network Access** - Chronicle exposes multiple ports for different services
20-
- **Configuration** - See [Configuration](configuration.md) for details
20+
- **Configuration** - See [Configuration](hosting/configuration.md) for details
2121

2222
## Architecture Overview
2323

Documentation/hosting/local-certificates.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,5 +246,5 @@ If the client cannot connect:
246246

247247
## Next Steps
248248

249-
- [Production Hosting](production.md) - Learn about production certificate requirements
250-
- [Configuration](configuration.md) - Complete configuration reference
249+
- [Production Hosting](hosting/production.md) - Learn about production certificate requirements
250+
- [Configuration](hosting/configuration.md) - Complete configuration reference

Documentation/hosting/production.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docker pull cratis/chronicle:1.0.0
1818

1919
## Configuration
2020

21-
Chronicle requires configuration to define its runtime behavior. For complete configuration details, see the [Configuration](configuration.md) guide.
21+
Chronicle requires configuration to define its runtime behavior. For complete configuration details, see the [Configuration](hosting/configuration.md) guide.
2222

2323
The configuration file must be mounted into the container at `/app/chronicle.json`, or you can use environment variables with the `Cratis__Chronicle__` prefix.
2424

@@ -80,11 +80,11 @@ volumes:
8080
1. **Use specific version tags** instead of `latest` for production deployments
8181
2. **Mount configuration as read-only** (`-v /path/to/chronicle.json:/app/chronicle.json:ro`)
8282
3. **Use environment-specific connection strings** for MongoDB
83-
4. **Configure appropriate timeouts** based on your infrastructure (see [Configuration](configuration.md))
83+
4. **Configure appropriate timeouts** based on your infrastructure (see [Configuration](hosting/configuration.md))
8484
5. **Enable health checks** for container orchestration
8585
6. **Set up monitoring** for all exposed ports
8686
7. **Use secrets management** for sensitive configuration values
87-
8. **Enable TLS** with proper certificates (see [TLS Configuration](../tls-configuration.md))
87+
8. **Enable TLS** with proper certificates (see [TLS Configuration](../tls-hosting/configuration.md))
8888

8989
## Health Checks
9090

@@ -95,7 +95,7 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
9595
CMD curl -f http://localhost:8080/health || exit 1
9696
```
9797

98-
> **Note**: The health check endpoint path is configurable. See [Configuration](configuration.md#health-check-endpoint) for details.
98+
> **Note**: The health check endpoint path is configurable. See [Configuration](hosting/configuration.md#health-check-endpoint) for details.
9999

100100
## Security Considerations
101101

@@ -104,7 +104,7 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
104104
- **Access Control**: Implement proper firewall rules for exposed ports
105105
- **Secrets Management**: Use external secret management for sensitive configuration
106106
- **Regular Updates**: Keep Chronicle and MongoDB images updated
107-
- **TLS Certificates**: Configure valid TLS certificates for production (see [TLS Configuration](../tls-configuration.md))
107+
- **TLS Certificates**: Configure valid TLS certificates for production (see [TLS Configuration](../tls-hosting/configuration.md))
108108

109109
## Scaling
110110

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) Cratis. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using Cratis.Chronicle.Events;
5+
6+
namespace Cratis.Chronicle.InProcess.Integration.for_ReadModels;
7+
8+
[EventType("2d1f20ee-f0fd-5b82-cfa9-cf6eefb23c63")]
9+
public record AnotherEvent(string Value);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) Cratis. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using Cratis.Chronicle.Events;
5+
6+
namespace Cratis.Chronicle.InProcess.Integration.for_ReadModels;
7+
8+
[EventType("1c0f19dd-e9fc-4a71-bfa8-bf5eefb12b52")]
9+
public record SomeEvent(int Number);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) Cratis. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
namespace Cratis.Chronicle.InProcess.Integration.for_ReadModels;
5+
6+
public class SomeProjection : IProjectionFor<SomeReadModel>
7+
{
8+
public ProjectionId Identifier => "some-projection";
9+
10+
public void Define(IProjectionBuilderFor<SomeReadModel> builder) => builder
11+
.From<SomeEvent>(e => e
12+
.Set(m => m.Number).To(e => e.Number))
13+
.From<AnotherEvent>(e => e
14+
.Set(m => m.Value).To(e => e.Value));
15+
}

0 commit comments

Comments
 (0)