publisher

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2026 License: BSD-2-Clause Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNoopSender

func NewNoopSender() task.CreateCommandSender

NewNoopSender returns a task.CreateCommandSender whose SendCommand method is a no-op (returns nil). Wired by main.go and cmd/run-once when DRY_RUN=true to avoid Kafka client init. The publisher's dryRun guard skips the sender call anyway; the noop exists so the application can construct itself without a real Kafka broker.

Types

type FrontmatterFormatter added in v0.1.0

type FrontmatterFormatter interface {
	// Format returns the frontmatter for one published task. String
	// values in `operator` are rendered through the same placeholder
	// substitution as title/body (`{{date}}`, `{{iso-week}}`, etc.);
	// non-string values (ints, slices, maps) pass through unchanged.
	// `slug` and `date` parameterize the placeholder render; `date` is
	// the Berlin civil date the task fires for (the publisher converts
	// wall-clock once at the tick boundary).
	Format(operator lib.TaskFrontmatter, slug string, date schedule.Date) lib.TaskFrontmatter
}

FrontmatterFormatter builds the YAML frontmatter stamped onto every published task. The formatter is the single seam between operator- supplied frontmatter (from `Schedule.spec.template.frontmatter`) and the wire-level `task.CreateCommand.Frontmatter` payload: it seeds published-author defaults, renders placeholder tokens in string values via the publisher's closed placeholder set, merges operator keys (which may override the defaults), and force-sets the provenance key `created_by: recurring-task-creator` last so a Schedule CR cannot impersonate a different author.

func NewFrontmatterFormatter added in v0.1.0

func NewFrontmatterFormatter() FrontmatterFormatter

NewFrontmatterFormatter returns the default FrontmatterFormatter that renders placeholders in string values via the publisher's closed placeholder set (see render.go). Stateless: safe to construct once and share across goroutines.

type Publisher

type Publisher interface {
	// Publish builds a CreateCommand for (def, date) and sends it. The
	// returned error is wrapped with the slug and ISO date in its message.
	// Same (def, date) on a second call produces a byte-identical command.
	Publish(ctx context.Context, def schedule.TaskDefinition, date schedule.Date) error
}

Publisher turns one (TaskDefinition, Date) pair into a validated task.CreateCommand and sends it via the injected task.CreateCommandSender.

func NewPublisher

func NewPublisher(
	sender task.CreateCommandSender,
	formatter FrontmatterFormatter,
	dryRun bool,
) Publisher

NewPublisher returns a Publisher that sends through sender, formatting frontmatter via formatter. The sender is invoked exactly once per Publish call (when inputs are valid). It validates the constructed command internally — see task.CreateCommandSender.SendCommand in github.com/bborbe/agent/lib/command/task. When dryRun is true, the publisher logs the would-be CreateCommand and skips the sender call (intended for local smoke-testing via cmd/run-once).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL