Tay.Worker behaviour (tay v0.7.0)

Copy Markdown View Source

The callback contract for a worker that accepts a Tay.Job.

Implement with @behaviour Tay.Worker and a perform/1 callback. :ok and {:ok, result} describe successful callback returns; {:error, reason} describes an unsuccessful return. Returned values are runtime terms, not an approved persisted representation.

use Tay.Worker, key: "stable.key" provides pure job builders. The configured Engine maps that stable key to a trusted module and executes perform/1 only after a durable start Event. Worker return terms are not persisted; only a bounded outcome diagnostic and final retry/discard decision are logged.

Summary

Callbacks

perform(t)

@callback perform(Tay.Job.t()) :: :ok | {:ok, term()} | {:error, term()}