publisher

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: BSD-2-Clause Imports: 9 Imported by: ? modules, 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

Overview

Package publisher emits typed task change events onto the vault's task topic. It is the producer half of the CQRS pair whose consumer is agent-task-executor's compacted task view: one record per task id, and a tombstone on delete.

The interface is deliberately caller-agnostic. Every mutation path in vault-api hands a task to it — the typed write handlers, and the pull path that detects externally pushed changes — so that exactly one process writes git and exactly one stream feeds every consumer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskPublisher

type TaskPublisher interface {
	// PublishChanged publishes an upsert event for the given task.
	PublishChanged(ctx context.Context, task lib.Task) error
	// PublishDeleted publishes a tombstone for the given task identifier.
	PublishDeleted(ctx context.Context, id lib.TaskIdentifier) error
}

TaskPublisher publishes task change and deletion events to Kafka.

func NewKafkaTaskPublisher

func NewKafkaTaskPublisher(
	ctx context.Context,
	brokers string,
	topicPrefix base.TopicPrefix,
	currentDateTimeGetter libtime.CurrentDateTimeGetter,
) (TaskPublisher, func() error, error)

NewKafkaTaskPublisher builds a TaskPublisher over a Kafka sync producer using lib.TaskV1SchemaID, so the topic name is derived from the schema rather than assembled here. The returned closer releases the producer and must be called when the publisher is no longer needed.

The producer-creation error path is deliberately not unit-tested: sarama blocks on an unreachable broker rather than failing fast, so a spec that passes a bogus broker string hangs instead of asserting. Covering it would need an injected producer-constructor seam that no caller needs yet; the path is exercised at deployment, where a bad broker string fails the process at startup.

func NewTaskPublisher

func NewTaskPublisher(
	eventObjectSender cdb.EventObjectSender,
	schemaID cdb.SchemaID,
	currentDateTimeGetter libtime.CurrentDateTimeGetter,
) TaskPublisher

NewTaskPublisher creates a TaskPublisher that sends events via EventObjectSender.

Jump to

Keyboard shortcuts

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