Skip to content

Hangfire.Core

reference
1 min readUpdated

Kind: Service

Source: Pams/API/Pams.API/Pams.API.csproj (line 1)

Part of: Pams

NuGet package dependency

Hangfire.Core is a NuGet package dependency declared in Pams/API/Pams.API/Pams.API.csproj. It supplies Hangfire background-job abstractions that Pams.API can reference when scheduling work outside HTTP request handling.

Diagram

mermaid
sequenceDiagram
    participant Client
    participant API as Pams.API
    participant Hangfire as Hangfire.Core

    Client->>API: Submit work request
    API->>Hangfire: Enqueue background job
    Hangfire-->>API: Return job identifier
    API-->>Client: Return request result

Usage

ts
// Call an API endpoint that schedules work through Hangfire.Core.
// The background-job configuration remains in the .NET Pams.API host.
async function submitBackgroundWork(payload: Record<string, unknown>) {
  const response = await fetch("/api/background-jobs", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify(payload),
  });

  if (!response.ok) {
    throw new Error("Background job request failed");
  }

  return response.json();
}

const job = await submitBackgroundWork({
  action: "process-request",
});

console.log(job);

AI Coding Instructions

  • Keep the Hangfire.Core dependency declaration in Pams.API.csproj consistent with the project’s existing NuGet package format.
  • Schedule Hangfire jobs from the .NET API layer; browser and TypeScript clients should call API endpoints rather than reference Hangfire.Core directly.
  • Check that Hangfire storage and server configuration exist in the API host before adding job scheduling code.
  • Avoid putting long-running work directly in HTTP request handlers when it should be queued as a background job.

Was this page helpful?

Download as PDF