{"modulePath":"github.com/uber/submitqueue","version":"v0.3.0-20261125210437-add1a4bd2ea2","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package hook\n\nPackage hook holds the hook event contract: the wire payload every domain publishes to its own hook topic for fire-and-forget lifecycle side effects.\n\n## Functions\n\n```go\nfunc Marshal(m proto.Message) ([]byte, error)\n```\nMarshal serializes a contract message to protojson bytes for the queue payload.\n\n```go\nfunc NewEventID(source, eventType, subjectID string, version int32) string\n```\nNewEventID mints the id of an event describing a versioned state write.\n\nDeriving the id rather than randomizing it is what makes replay safe: the same transition mints the same id, so the queue dedupes a redelivery and a hook stays idempotent without a publisher-side outbox. version is the subject's version immediately after the write, which is what separates two transitions of the same subject.\n\n```go\nfunc NewUnversionedEventID(source, eventType, subjectID, causeID string, ordinal int) string\n```\nNewUnversionedEventID mints the id of an event whose transition was not a versioned write, so no version distinguishes one occurrence from the next.\n\nThe causing message's id stands in for the version, being stable across redeliveries for the same reason a version is. ordinal separates several same-typed events published for one cause; pass 0 when there is only one.\n\n```go\nfunc TopicKeys(m proto.Message) []string\n```\nTopicKeys returns the logical topic keys bound to a message via the topic\\_keys proto option, or nil if it declares none. These are not wire topic names; a caller maps each key to its backend's topic.\n\n```go\nfunc Unmarshal[T proto.Message](b []byte, m T) error\n```\nUnmarshal deserializes protojson bytes into the contract message m.\n\n```go\nfunc Validate(e *HookEvent) error\n```\nValidate reports whether e carries the three envelope fields every consumer keys on. The rest cannot be checked generically: version is legitimately 0 for an unversioned transition and payload is shaped per type.\n\nBoth sides call it — a publisher to catch a malformed event before it reaches the queue, a consumer because the producer may not have.\n\n## Types\n\n```go\ntype HookEvent = protopb.HookEvent\n```\nHookEvent aliases the generated binding so callers reference the contract through this package rather than protopb.\n\n```go\ntype TopicKey = consumer.TopicKey\n```\nTopicKey looks up a queue backend, topic name, and subscription config in a consumer.TopicRegistry.\n\n```go\nconst TopicKeyHook TopicKey = \"hook\"\n```\nTopicKeyHook carries hook events. The key is per-host, not global: each domain runs its own hook topic, so two domains sharing a queue backend must map this to distinct topic names.\n\n","path":"github.com/uber/submitqueue/api/base/hook","name":"hook","synopsis":"Package hook holds the hook event contract: the wire payload every domain publishes to its own hook topic for fire-and-forget lifecycle side effects.","isRedistributable":true}
