WJb Examples & Demos

Explore background jobs, workflows, scheduling, dependency injection, and core WJb capabilities in action.

Getting Started
Configuration
Workflows

โฐ Ping Website

Uses CronScheduler to check website availability every minute and record the response.

Flow: Cron Schedule โ†’ Enqueue โ†’ HTTP Ping โ†’ Complete
using WJb;

namespace WJbPro.Demos.Actions;

public sealed class HttpPingPayload
{
    public string? Url { get; set; }
}

public sealed class HttpPingAction : JobAction<HttpPingPayload>
{
    public const string Key = "http-ping";

    private readonly HttpClient _httpClient = new();

    public override async Task<IActionResult> ExecuteAsync(
        HttpPingPayload input, CancellationToken ct = default)
    {
        ReportProgress(10, $"HttpClient: {_httpClient != null}");

        var url = input.Url ?? "https://wjb.pro/";

        using var response = await _httpClient.GetAsync(url, ct);

        ReportProgress(100, $"{url} → {(int)response.StatusCode} {response.StatusCode}");

        return await CompleteAsync();
    }
}

Jobs

15 job(s)
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:13:00.041 โ†’ 00:13:00.055 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:12:00.041 โ†’ 00:12:00.048 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:11:00.025 โ†’ 00:11:00.093 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:10:00.105 โ†’ 00:10:00.373 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:09:00.085 โ†’ 00:09:00.126 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:08:00.040 โ†’ 00:08:00.048 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:07:00.040 โ†’ 00:07:00.051 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:06:00.040 โ†’ 00:06:00.073 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:05:00.040 โ†’ 00:05:00.048 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:04:00.040 โ†’ 00:04:00.048 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:03:00.040 โ†’ 00:03:00.049 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:02:00.024 โ†’ 00:02:00.037 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:01:00.025 โ†’ 00:01:00.055 UTC
clean-up
Completed
100%
Removed 18 jobs.
00:00:00.044 โ†’ 00:00:00.047 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
00:00:00.044 โ†’ 00:00:00.135 UTC
Showing 1 - 15
An unhandled error has occurred. Reload ๐Ÿ—™

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.