Documentation
¶
Index ¶
- type PubSub
- type PubSubOpt
- func WithPubSubLogger(l *zerolog.Logger) PubSubOpt
- func WithPubSubPassword(password string) PubSubOpt
- func WithPubSubSubjectPrefix(prefix string) PubSubOpt
- func WithPubSubTLSEnabled(enabled bool) PubSubOpt
- func WithPubSubTLSRootCAFile(path string) PubSubOpt
- func WithPubSubURL(url string) PubSubOpt
- func WithPubSubUsername(username string) PubSubOpt
- type PubSubOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
PubSub implements msgqueue.PubSub over core NATS. Subjects are subjectPrefix + "." + topic.Name() (default prefix "hatchet.pubsub"), delivery is best-effort at-most-once.
func NewPubSub ¶
NewPubSub connects synchronously to NATS and returns a PubSub. Fails if the server is unreachable or if its max_payload is below msgqueue.MaxMessageSize.
func (*PubSub) Pub ¶
Pub publishes a message to the topic. Oversized multi-payload messages are chunked like rabbitmq/pubsub.go.
func (*PubSub) Sub ¶
Sub subscribes to a topic with plain Subscribe (fan-out to every subscriber). Delivery is at-most-once: handler errors are logged, never redelivered, and while the subscription has a backlog, messages older than the topic kind's maxMessageAge are skipped. Handlers run concurrently, up to the topic kind's maxConcurrentHandlers, with no ordering between messages. When every slot is busy the subscription callback waits, so the backlog stays in the nats.go pending buffer. The returned cleanup waits for running handlers and must not be called from a handler.
type PubSubOpt ¶
type PubSubOpt func(*PubSubOpts)
func WithPubSubLogger ¶
func WithPubSubPassword ¶
WithPubSubPassword sets the NATS password for nats.UserInfo.
func WithPubSubSubjectPrefix ¶
WithPubSubSubjectPrefix sets the NATS subject prefix (default "hatchet.pubsub"). Empty falls back to the default. No trimming or validation: a bad prefix fails loudly via nats ErrBadSubject at startup.
func WithPubSubTLSEnabled ¶ added in v0.105.1
WithPubSubTLSEnabled requires TLS with a TLS-first handshake (the server must enable handshake_first). Verification uses the system roots unless a root CA file is set.
func WithPubSubTLSRootCAFile ¶ added in v0.105.1
WithPubSubTLSRootCAFile sets a PEM CA bundle for server verification. Requires WithPubSubTLSEnabled(true).
func WithPubSubURL ¶
WithPubSubURL sets the NATS seed URL(s). Comma-separated lists are passed through to nats.go. Prefer bare hosts and set Username/Password so rediscovered cluster peers authenticate.
func WithPubSubUsername ¶
WithPubSubUsername sets the NATS username for nats.UserInfo.
type PubSubOpts ¶
type PubSubOpts struct {
// contains filtered or unexported fields
}