Subtask.Storage.MongoDB
1.0.1
dotnet add package Subtask.Storage.MongoDB --version 1.0.1
NuGet\Install-Package Subtask.Storage.MongoDB -Version 1.0.1
<PackageReference Include="Subtask.Storage.MongoDB" Version="1.0.1" />
<PackageVersion Include="Subtask.Storage.MongoDB" Version="1.0.1" />
<PackageReference Include="Subtask.Storage.MongoDB" />
paket add Subtask.Storage.MongoDB --version 1.0.1
#r "nuget: Subtask.Storage.MongoDB, 1.0.1"
#:package Subtask.Storage.MongoDB@1.0.1
#addin nuget:?package=Subtask.Storage.MongoDB&version=1.0.1
#tool nuget:?package=Subtask.Storage.MongoDB&version=1.0.1
Subtask.Storage.MongoDB
Subtask.Storage.MongoDB is the server side of the Subtask library, used to manage and schedule the running of processes.
Installation
The Subtask.Storage.MongoDB Nuget package can be found at https://nuget.org/packages/Subtask.Storage.MongoDB/.
To install it via the .NET CLI, simply enter:
dotnet add package Subtask.Storage.MongoDB
Examples
Initialization - DefaultStorage
var client = new MongoClient(/*YOUR CONNECTION STRING*/);
var database = client.GetDatabase(databaseName); // Create a database if databaseName doesn't exist yet
database.CreateCollection(collectionName); // Create a collection
var collection = database.GetCollection<MDProcess>(collectionName);
var storage = new DefaultStorage(collection, collectionName);
Get a Process
bool result = storage.TryGetProcess(
tenantId,
idToGet,
out IProcess process,
new CancellationToken()
);
Get a Process in a Specific Application
bool result = storage.TryGetProcessByApplication(
applicationName,
idToGet,
out IProcess process,
new CancellationToken()
);
Get All Processes in a Tenant ID
IAsyncCursor<IProcess> cursor = storage.GetProcesses("TestDefaultStorage Tenant 1");
Get All Processes
IAsyncCursor<IProcess> cursor = storage.GetProcesses();
Create a Process
var process = await storage.GetOrCreateProcess(
applicationName,
tenantId,
user,
new SubtaskMeta(
name,
typeof(MDProcess),
new ThreadRelieverSettingsFactory(),
uniqueKey
),
new TestProcessInput(5),
new CancellationToken()
);
Get the Next Process for Execution
var result = await storage.TryGetNextProcessForExecution(applicationName, new CancellationToken());
Updating Process Status
await storage.UpdateProcessPreparing(idToUpdate, new CancellationToken());
await storage.UpdateProcessRunning(idToUpdate, new CancellationToken());
await storage.UpdateProcessStopping(idToUpdate, new CancellationToken());
await storage.UpdateProcessStopped(idToUpdate, new CancellationToken());
await storage.UpdateProcessFailed(idToUpdate, failMessage, /* bool */ isComingFromRuntime, new CancellationToken());
await storage.UpdateProcessError(idToUpdate, errorMessage, new CancellationToken());
Remove Completed Processes in a Tenant ID
await storage.RemoveCompletedProcesses(tenantId, new CancellationToken());
Remove Completed Processes from All Available Processes
await storage.RemoveCompletedProcesses(new CancellationToken());
Remove Single Completed Process in a Tenant ID
await _storage.RemoveCompletedProcess(tenantId, idToRemove, new CancellationToken());
Delete a Process
await storage.DeleteProcess(idToDelete, new CancellationToken());
Reset a Failed Process
TryResults<IProcess> result = await storage.TryResetProcess(idToReset, new CancellationToken());
Ping a Process
await storage.Ping(idToPing, new CancellationToken());
Cleaning up Orphan Runners in an Application
Fails processes that have not been pinged (inactive) in the last 60 seconds.
await storage.CleanupOrphanRunners(applicationName, new CancellationToken())
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- MongoDB.Driver (>= 3.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 192 | 5/22/2025 |
| 1.0.1-beta.1 | 147 | 5/22/2025 |
| 1.0.0 | 190 | 5/22/2025 |
| 1.0.0-beta.11 | 142 | 5/22/2025 |
| 1.0.0-beta.10 | 171 | 3/10/2025 |
| 1.0.0-beta.9 | 163 | 3/10/2025 |
| 1.0.0-beta.8 | 167 | 3/8/2025 |
| 1.0.0-beta.7 | 202 | 3/6/2025 |
| 1.0.0-beta.6 | 203 | 3/6/2025 |
| 1.0.0-beta.5 | 196 | 3/6/2025 |
| 1.0.0-beta.4 | 202 | 3/5/2025 |
| 1.0.0-beta.3 | 204 | 3/5/2025 |
| 1.0.0-beta.2 | 201 | 3/5/2025 |
| 1.0.0-beta.1 | 201 | 3/5/2025 |
| 0.0.1-beta | 239 | 3/4/2025 |
| 0.0.0-beta | 233 | 3/4/2025 |