-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'add_logo_and_diagram' of https://github.com/koralium/fl…
…owtide into add_logo_and_diagram
- Loading branch information
Showing
186 changed files
with
3,103 additions
and
1,364 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
sidebar_position: 4 | ||
--- | ||
|
||
import DocCardList from '@theme/DocCardList'; | ||
|
||
|
||
|
||
# Deployment | ||
|
||
This section covers information that can be useful when deploying flowtide. | ||
|
||
<DocCardList /> |
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,73 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Pause And Resume | ||
|
||
It is possible to pause and resume a flowtide stream, this is useful when there might be maintainance work on a source system, or as a panic button to stop | ||
the execution. | ||
|
||
A pause does not stop the stream, but stops the traversal of all events inside of the stream. This means that resuming a paused stream is quick and does | ||
not need to download any state from persistent storage. | ||
|
||
## Pause and stop using IConfiguration | ||
|
||
One of the easier ways to add pause and resume is to utilize `IConfiguration` in .NET. Flowtide uses an `IOptionsMonitor<FlowtidePauseOptions>` to check | ||
for changes on the configuration and pauses and resumes the stream based on the value. | ||
|
||
The class looks as follows: | ||
|
||
``` | ||
public class FlowtidePauseOptions | ||
{ | ||
public bool IsPaused { get; set; } | ||
} | ||
``` | ||
|
||
So to utilize this when using `FlowtideDotNet.AspNetCore` or `FlowtideDotNet.DependencyInjection` you add the following: | ||
|
||
``` | ||
var builder = WebApplication.CreateBuilder(args); | ||
... | ||
// Map flowtide pause options to enable pausing and resuming from configuration | ||
builder.Services.AddOptions<FlowtidePauseOptions>() | ||
.Bind(builder.Configuration.GetSection("your_section")); | ||
... | ||
// Add the stream as normal | ||
builder.Services.AddFlowtideStream("stream_name") | ||
... | ||
``` | ||
|
||
This is best fitted with an `IConfiguration` provider that supports loading changes dynamically such as Hashicorp Vault or Azure Key Vault. | ||
Pausing and resuming using `IConfiguration`provider is dependent on the update frequency of the provider, so to utilize this fully this interval should be | ||
kept quite low. | ||
|
||
## Pause and stop using API endpoint | ||
|
||
When using `FlowtideDotNet.AspNetCore` you can also map API endpoints to allow for pause and resume. | ||
|
||
Example: | ||
|
||
``` | ||
var builder = WebApplication.CreateBuilder(args); | ||
... | ||
// Add the stream as normal | ||
builder.Services.AddFlowtideStream("stream_name") | ||
... | ||
var app = builder.Build(); | ||
... | ||
// Map pause and resume endpoints | ||
app.UseFlowtidePauseResumeEndpoints("base_path"); | ||
``` | ||
|
||
Two endpoints are registered under the base path, `/pause` and `/resume`. |
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,32 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Object State | ||
|
||
The object state is the simplest type of state for an operator, it saves a C# object using JSON serialization to store it in persistent storage. | ||
|
||
An object state can be fetched from the `IStateManagerClient` using `GetOrCreateObjectStateAsync<T>(string name)`. | ||
|
||
Example: | ||
|
||
```csharp | ||
protected override async Task InitializeOrRestore(long restoreTime, IStateManagerClient stateManagerClient) | ||
{ | ||
_state = await stateManagerClient.GetOrCreateObjectStateAsync<MyState>("my_state"); | ||
} | ||
|
||
protected override async Task OnCheckpoint() | ||
{ | ||
// Commit any changes made to the state | ||
await _state.Commit(); | ||
} | ||
|
||
public void OtherMethod() | ||
{ | ||
_state.Value.Test = "hello"; | ||
} | ||
``` | ||
|
||
The object state saves an internal copy of the value that was last commited and checkpointed, if the value has not changed nothing will be written to persistent storage. | ||
So a user of the object state does not have to handle conditional calls to `Commit` to reduce the number of writes to persistent storage. |
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
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
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
Oops, something went wrong.