lightweight async job implementation
AsyncJob is a lightweight implementation of asynchronous job orchestration, leveraging Microsoft Azure Functions and Durable Tasks. It is designed to handle job lifecycles with states such as Queued
, InProgress
, and Completed
. The project is particularly suited for applications requiring reliable, stateful, and distributed task management.
- Azure Functions Integration: AsyncJob uses Azure Functions to define and execute orchestrators and triggers.
- Durable Task Framework: The project employs the Durable Task framework for managing long-running workflows and state persistence.
- Customizable Durations: Job states such as
Queued
andInProgress
can be customized using environment variables. - State Management: Provides detailed logging and state transitions for each job instance.
- HTTP Trigger Support: The
JobStartTrigger
function allows initiating jobs via HTTP requests.
The project uses the following environment variables for configuration:
ASYNC_JOB_QUEUED_DURATION_SEC
: Specifies the duration (in seconds) for which a job remains in theQueued
state.ASYNC_JOB_INPROGRESS_DURATION_SEC
: Specifies the duration (in seconds) for which a job remains in theInProgress
state.
- Job Initialization:
- A job is started via an HTTP GET request to the
job-start/{jobName}
route. - The job parameters, including durations, are extracted from the environment variables.
- A job is started via an HTTP GET request to the
- State Transitions:
- The job transitions through
Queued
andInProgress
states, with timers set for each phase. - Custom status messages are logged at each step.
- The job transitions through
- Completion:
- The job concludes with a
Completed
state, and an HTTP response is returned to the client.
- The job concludes with a
You can query the current status of a job instance using the AsyncJobStatus HTTP endpoint:
/job-status/{jobName}
This endpoint returns the current status of the specified job instance. Example response:
{
"status": "Queued"
}
Use this endpoint to programmatically monitor the progress and state of your asynchronous jobs.
AsyncJob is licensed under the MIT License, allowing for flexible use and modification in both personal and commercial projects.