Josupeit.Practices.Jobs.Abstractions
1.1.3
Prefix Reserved
dotnet add package Josupeit.Practices.Jobs.Abstractions --version 1.1.3
NuGet\Install-Package Josupeit.Practices.Jobs.Abstractions -Version 1.1.3
<PackageReference Include="Josupeit.Practices.Jobs.Abstractions" Version="1.1.3" />
<PackageVersion Include="Josupeit.Practices.Jobs.Abstractions" Version="1.1.3" />
<PackageReference Include="Josupeit.Practices.Jobs.Abstractions" />
paket add Josupeit.Practices.Jobs.Abstractions --version 1.1.3
#r "nuget: Josupeit.Practices.Jobs.Abstractions, 1.1.3"
#:package Josupeit.Practices.Jobs.Abstractions@1.1.3
#addin nuget:?package=Josupeit.Practices.Jobs.Abstractions&version=1.1.3
#tool nuget:?package=Josupeit.Practices.Jobs.Abstractions&version=1.1.3
Josupeit.Practices.Jobs.Abstractions
A scheduler runs fire-and-forget work items. A job is something richer: it has an observable lifecycle, an identity, and it may carry a result or report incremental progress. This package defines the contracts for that model.
The typical flow is: create a job through a factory, start it, observe its state via the Changed event or by awaiting it directly, and read the result or exception once it completes.
dotnet add package Josupeit.Practices.Jobs.Abstractions
Core interface: IJob
public interface IJob
{
Guid Id { get; } // stable identity across the job's lifetime
bool IsPending { get; } // submitted but not yet picked up by the executor
bool IsExecuting { get; } // currently running
bool IsCompleted { get; } // true for canceled, faulted, and successful outcomes
bool IsCompletedSuccessfully { get; }
bool IsFaulted { get; }
bool IsCanceled { get; }
Exception? Exception { get; } // set when IsFaulted is true
event EventHandler Changed; // raised on every state transition
void Start();
void Cancel();
}
Job variants
Plain IJob covers the most common case. When you need more, use one of the typed variants.
| Interface | Additional member |
|---|---|
IJobWithResult<TResult> |
TResult Result — available once IsCompletedSuccessfully is true |
IJobWithProgress<TProgress> |
TProgress Progress — updated via IProgress<TProgress> callbacks during execution |
IJobWithProgressAndResult<TProgress, TResult> |
Both of the above |
Creating jobs: IJobFactory
IJobFactory creates job instances from async delegates. Every overload accepts either a plain Func<Task> or a cancellable Func<CancellationToken, Task>. The typed variants add IProgress<TProgress> and Task<TResult> as appropriate.
Awaiting a job
Jobs are awaitable out of the box. The GetAwaiter() extension method and a synchronous Wait() counterpart are both provided by this package, so you can integrate jobs naturally into async code.
IJobFactory factory = /* TaskPoolJobFactory or SchedulerJobFactory */;
IJob job = factory.Create(async ct => await DoWorkAsync(ct));
job.Start();
await job; // awaits completion; does not throw if the job was canceled or faulted
job.Wait(); // synchronous equivalent
// Read the outcome.
if (job.IsFaulted)
Console.WriteLine(job.Exception);
For concrete factory implementations, use Josupeit.Practices.Jobs.TaskPool or Josupeit.Practices.Jobs.Scheduler.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Josupeit.Practices.Jobs.Abstractions:
| Package | Downloads |
|---|---|
|
Josupeit.Practices.Jobs.Core
Abstract base class for custom IJob implementations. Provides stable identity, state management, cancellation, the Changed event, and guard helpers for transition validation. |
GitHub repositories
This package is not used by any popular GitHub repositories.
- Fixes release notes being empty when packing at a tagged commit;- Bumps Jobs.Abstractions, Jobs.Core and Jobs.Scheduler to 1.1;- Adds ConfigureAwait support for IJob;- Documents per-call allocation in GetAwaiter;- Documents deadlock risk on IJobAwaiter.GetResult and Wait;- Implements ICriticalNotifyCompletion on IJobAwaiter;- Fixes event handler leak in JobAwaiter by deferring subscription;- Fixes invalid NuGet dependency version ranges that prevented package push