https://github.com/andryushchenko/ainq.background
Background work utilities for .NET Core apps based on Hosted services
https://github.com/andryushchenko/ainq.background
background cron dotnet hostedservices queue
Last synced: 3 months ago
JSON representation
Background work utilities for .NET Core apps based on Hosted services
- Host: GitHub
- URL: https://github.com/andryushchenko/ainq.background
- Owner: andryushchenko
- License: apache-2.0
- Created: 2020-05-07T20:13:56.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2026-01-18T09:23:29.000Z (6 months ago)
- Last Synced: 2026-01-18T17:34:05.150Z (6 months ago)
- Topics: background, cron, dotnet, hostedservices, queue
- Language: C#
- Homepage:
- Size: 1.38 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AInq.Background
[](https://github.com/andryushchenko/AInq.Background/releases) [](LICENSE)

## What is it?
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
## New in 4.1
- **BREAKING CHANGES**
- **Startup work** utility moved to separate package **AInq.Background.Startup**
- Minor bug fix and internal optimization
## New in 4.0
- **BREAKING CHANGES**
- Background work Scheduler interfaces moved to separate package **AInq.Background.Scheduler.Abstraction**
- Background work Scheduler now uses `Try` and `Maybe` from **AInq.Optional** to pass errors logically correct to Observable
- Background work Scheduler now uses **System.Reactive** instead of custom buggy `IObservable` implementation
## New in 3.0
- **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` and `AccessFactory`
- Some extension methods moved form `AInq.Background.Helpers` namespace to `AInq.Background.Extensions` and `AInq.Background.Interaction`
- ~~`IActivatable`~~ `IStartStopppable`
## Packages description
#### [](https://www.nuget.org/packages/AInq.Background.Abstraction/) AInq.Background.Abstraction
Basic interfaces and helpers library.
- Basic interfaces and factory classes:
- Work interfaces: `IWork`, `IWork`, `IAsyncWork`, `IAsyncWork`
- `WorkFactory` for creating simple work instances from delegates
- Resource access interfaces: `IAccess`, `IAccess`, `IAsyncAccess`, `IAsyncAccess`
- `AccessFactory` for creating simple access instances from delegates
- `IConveyorMachine` for conveyor data processing machines
- `IActivatable` and `IThrottling` for shared resources and conveyor machines with particular usage strategies
- Service interfaces
- `IWorkQueue` and `IPriorityWorkQueue` for background task queue
- `IAccessQueue` and `IPriorityAccessQueue` for shared resource access queue
- `IConveyor` and `IPriorityConveyor` for background data processing conveyor
- Helpers and extensions including methods to use services together (e.g. enqueue `IAccess` to `IWorkQueue`) if needed
#### [](https://www.nuget.org/packages/AInq.Background/) AInq.Background
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.
#### [](https://www.nuget.org/packages/AInq.Background.Scheduler.Abstraction/) AInq.Background.Scheduler.Abstraction
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` to `IWorkScheduler`) if needed
#### [](https://www.nuget.org/packages/AInq.Background.Scheduler/) AInq.Background.Scheduler
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](https://github.com/HangfireIO/Cronos) is used for parsing Cron expressions - follow documentation for supported options. Format with seconds is supported.
#### [](https://www.nuget.org/packages/AInq.Background.Enumerable/) AInq.Background.Enumerable
**NEW** Batch processing extensions for `IWorkQueue`, `IAccessQueue` and `IConveyor`
#### [](https://www.nuget.org/packages/AInq.Background.Startup/) AInq.Background.Startup
**NEW** Startup work utility for running some work *before* host start
Support interaction with background work queue
## Documentation
As for now documentation is provided in this document and by XML documentation inside packages.
## Contribution
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.
## License
Copyright © 2020 Anton Andryushchenko. AInq.Background is licensed under [Apache License 2.0](LICENSE)