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 ¶
func IsPermanent ¶ added in v0.7.0
IsPermanent reports whether a publish error can never succeed on retry because the broker rejected the message itself rather than the connection.
The distinction is load-bearing for the pull path: a caller that retries transient failures forever needs to know which failures are not transient, and the alternative — counting every failure toward an abandonment cap — drops real changes during any outage longer than a few ticks.
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.