Background work utilities for .NET Core apps based on Hosted services. Originally designed for accessing API with strict request-per-second limit.
- Background work queue with configurable parallelism and optional prioritizing
- Shared resource access queue with different resource reuse strategies and optional prioritizing
- Background data processing conveyor with different conveyor machine reuse strategies and optional prioritizing
- Work scheduler with Cron support
- Startup work utility
- BREAKING CHANGES
- Startup work utility moved to separate package AInq.Background.Startup
- Minor bug fix and internal optimization
- BREAKING CHANGES
- Background work Scheduler interfaces moved to separate package AInq.Background.Scheduler.Abstraction
- Background work Scheduler now uses
Try
andMaybe
from AInq.Optional to pass errors logically correct to Observable
- Background work Scheduler now uses System.Reactive instead of custom buggy
IObservable<T>
implementation
- GENERAL BUGFIX
- New features
- Service interaction extensions
- Batch processing extension
- Repeated work in
IWorkScheduler
- Work results in
IWorkScheduler
- Refactoring
- Simplify basic interfaces: non-basic methods moved to extensions
- Cleanup Helpers and Extensions classes struct
- BREAKING CHANGES
- Removed some unused methods from
WorkFactory
andAccessFactory
- Some extension methods moved form
AInq.Background.Helpers
namespace toAInq.Background.Extensions
andAInq.Background.Interaction
IActivatable
IStartStopppable
- Removed some unused methods from
Basic interfaces and helpers library.
- Basic interfaces and factory classes:
- Work interfaces:
IWork
,IWork<TResult>
,IAsyncWork
,IAsyncWork<TResult>
WorkFactory
for creating simple work instances from delegates- Resource access interfaces:
IAccess<TResource>
,IAccess<TResource, TResult>
,IAsyncAccess<TResource>
,IAsyncAccess<TResource, TResult>
AccessFactory
for creating simple access instances from delegatesIConveyorMachine<TData, TResult>
for conveyor data processing machinesIActivatable
andIThrottling
for shared resources and conveyor machines with particular usage strategies
- Work interfaces:
- Service interfaces
IWorkQueue
andIPriorityWorkQueue
for background task queueIAccessQueue<TResource>
andIPriorityAccessQueue<TResource>
for shared resource access queueIConveyor<TData, TResult>
andIPriorityConveyor<TData, TResult>
for background data processing conveyor
- Helpers and extensions including methods to use services together (e.g. enqueue
IAccess<TResource>
toIWorkQueue
) if needed
Queues and conveyor implementations.
- Background work queue
- Optional support for configurable parallelism
- Optional support for prioritizing
- Use
WorkQueueInjection
to register service or create for internal usage
- Shared resource access queue
- Support single or many resource instances with different lifetime
- Optional support for prioritizing
- Use
AccessQueueInjection
to register service or create for internal usage
- Background data processing conveyor
- Support single or many conveyor machines with different lifetime
- Optional support for prioritizing
- Use
ConveyorInjection
to register service or create for internal usage
You can extend functionality by implementing custom ITaskWrapper
, ITaskManager
or ITaskProcessor
and combine with existing ones to create more service variants.
Work scheduler interfaces and helpers library.
- Service interfaces
IWorkScheduler
for background work scheduler
- Helpers and extensions including methods to use services together (e.g. schedule
IAccess<TResource>
toIWorkScheduler
) if needed
Work scheduler implementation.
- Support delayed, time-scheduled, and cron-scheduled work
- Use
WorkSchedulerInjection
to register service or create for internal usage
You can extend functionality by implementing custom IScheduledTaskWrapper
or IWorkSchedulerManager
and combine with existing ones to create more service variants.
NOTE: Cronos is used for parsing Cron expressions - follow documentation for supported options. Format with seconds is supported.
NEW Batch processing extensions for IWorkQueue
, IAccessQueue<TResource>
and IConveyor<TData, TResult>
NEW Startup work utility for running some work before host start
Support interaction with background work queue
As for now documentation is provided in this document and by XML documentation inside packages.
These packages are in active production use, all fixes and improvements will be published after some internal testing.
If you find a bug, have a question or something else - you are friendly welcome to open an issue.
Copyright © 2020 Anton Andryushchenko. AInq.Background is licensed under Apache License 2.0