Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidEnvelope = errors.New("invalid envelope")
ErrInvalidEnvelope indicates the message structure is malformed.
var ErrNoHandler = errors.New("no handler registered")
ErrNoHandler indicates no registered handler matched the message.
var ErrSchemaValidation = errors.New("schema validation failed")
ErrSchemaValidation indicates the payload did not match the expected struct.
var ErrTransientFailure = errors.New("transient failure, please retry")
ErrTransientFailure indicates a transient failure that may succeed if retried.
var ErrUnprocessableEntity = errors.New("unprocessable entity")
ErrUnprocessableEntity indicates the entity could not be processed.
Functions ¶
func New ¶
New creates a publishable JSON payload for the given event. It wraps the event data in the standard envelope with the correct Kind and APIVersion.
func Register ¶
func Register[T Event](r *Router, handler TypedHandler[T])
Register adds a new handler for a specific Kind and APIVersion. T: The struct type you want to receive (e.g. *IngestionJobV1). The router will automatically json.Unmarshal the message into T before calling handler. This function PANICS if a handler for the same Kind and APIVersion is already registered.
Types ¶
type Event ¶
Event is the interface that all routable messages must implement. It allows the router to infer the Kind and APIVersion from the type itself.