-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving away from aggregate store (#368)
* Added truncation to SQL stores * Added tiered event store * Document persistence changes * Added the last change in subscriptions to the docs * Add RMQ docs * Add queue name to RMQ, handle empty stream for ExpectedNew as non-existent. --------- Co-authored-by: Ruben Bartelink <ruben@bartelink.com>
- Loading branch information
1 parent
526a4a4
commit 21e940c
Showing
287 changed files
with
4,961 additions
and
2,656 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
### Result | ||
|
||
The command service will return an instance of `Result<TState>`. It can be inspected using the following members: | ||
|
||
| Signature | Description | | ||
|----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `bool TryGet(out Result<TState>.Ok ok)` | Returns `true` if the result is successful and also returns `Result<TState>.Ok` as the `out` variable. | | ||
| `bool TryGetError(out Result<TState>.Error error)` | Returns `true` if there was an error. The `error` then gets assigned to an instance of `Error` that contains more details about what went wrong. | | ||
| `bool Success` | Returns `true` if the result is successful. | | ||
| `Exception? Exception { get; }` | Returns an exception instance if there was an error, or `null` if there was no exception. | | ||
| `void ThrowIfError()` | Throws the recorded exception if there was an error, does nothing otherwise. | | ||
| `T Match<T>(Func<Ok, T> matchOk, Func<Error, T> matchError)` | Can be used for pattern matching success and error if the output has the same type. Eventuous uses this function for producing `IResult` and `ActionResult` in HTTP API extensions. | | ||
| `void Match<T>(Action<Ok> matchOk, Action<Error> matchError)` | Allows to execute code branches based on the result success. | | ||
| `Task MatchAsync<T>(Func<Ok, Task> matchOk, Func<Error, Task> matchError)` | Allows to execute async code branches based on the result success. | | ||
|
||
When using `TryGet`, you get the `Ok` instance back, which contains the following properties: | ||
|
||
| Property | Description | | ||
|------------------------|----------------------------------------------------------------------------------------------------------| | ||
| `TState State` | New state instance | | ||
| `Change[] Changes` | List of new events. `Change` struct contains both the event payload and its type. | | ||
| `ulong StreamPosition` | Position of the last event in the stream that can be used for tracking, for example, read model updates. | | ||
|
||
The `Match` function also provides `Ok` for the `matchOk` function to use. | ||
|
||
When using `TryGetError`, you get the `Error` instance back, which contains the following properties: | ||
|
||
| Property | Description | | ||
|------------------------|---------------------------------------------------------------------| | ||
| `string ErrorMessage` | The error message, which can be custom or taken from the exception. | | ||
| `Exception? Exception` | Exception details if available. | |
5 changes: 5 additions & 0 deletions
5
docs/versioned_docs/version-0.15/application/_service_http.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Application HTTP API | ||
|
||
The most common use case is to connect the command service to an HTTP API using controllers or minimal API mappings. | ||
|
||
Read the [Command API](./command-api) feature documentation for more details. |
3 changes: 3 additions & 0 deletions
3
docs/versioned_docs/version-0.15/application/_service_no_throw.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:::caution Handling failures | ||
The last point above translates to: the command service **does not throw exceptions**. It [returns](#result) an instance of `Result<TState>.Error` instead. It is your responsibility to handle the error. | ||
::: |
13 changes: 13 additions & 0 deletions
13
docs/versioned_docs/version-0.15/application/_service_registration.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## Bootstrap | ||
|
||
If you registered an implementation of `IEventStore` in the DI container, you can also register the command service: | ||
|
||
```csharp title="Program.cs" | ||
builder.Services.AddCommandService<BookingCommandService, BookingState>(); | ||
``` | ||
|
||
The `AddCommandService` extension will register the `BookingService`, and also as `ICommandService<BookingState>`, as a singleton. Remember that all the DI extensions are part of the `Eventuous.Extensions.DependencyInjection` NuGet package. | ||
|
||
When you also use `AddControllers`, you get the command service injected to your controllers. | ||
|
||
You can simplify your application and avoid creating HTTP endpoints explicitly (as controllers or minimal API endpoints) if you use the [command API feature](command-api.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.