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

20 job(s)
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
23:07:00.036 โ†’ 23:07:00.044 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
23:06:00.036 โ†’ 23:06:00.044 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
23:05:00.037 โ†’ 23:05:00.045 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
23:04:00.035 โ†’ 23:04:00.043 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
23:03:00.035 โ†’ 23:03:00.062 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
23:02:00.035 โ†’ 23:02:00.048 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
23:01:00.034 โ†’ 23:01:00.046 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
23:00:00.036 โ†’ 23:00:00.051 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:59:00.033 โ†’ 22:59:00.048 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:58:00.033 โ†’ 22:58:00.060 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:57:00.033 โ†’ 22:57:00.043 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:56:00.033 โ†’ 22:56:00.041 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:55:00.033 โ†’ 22:55:00.042 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:54:00.033 โ†’ 22:54:00.053 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:53:00.032 โ†’ 22:53:00.060 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:52:00.032 โ†’ 22:52:00.049 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:51:00.034 โ†’ 22:51:00.045 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:50:00.032 โ†’ 22:50:00.040 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:49:00.040 โ†’ 22:49:00.096 UTC
http-ping
Completed
100%
https://wjb.pro/ → 200 OK
22:48:00.034 โ†’ 22:48:00.065 UTC
Showing 1 - 20
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.