Documentation
¶
Overview ¶
Package nats adapts Core NATS queue subscriptions, not JetStream. Delivery is transient without handler acknowledgements or durable replay. Construction opens and subscribes an owned connection; Shutdown drains/closes it. Request decoding is bounded, but broker acceptance is not proof of handler completion.
Index ¶
- type Option
- func WithAddr(addrs ...string) Option
- func WithConnectTimeout(timeout time.Duration) Option
- func WithLogger(l queue.Logger) Option
- func WithQueue(queue string) Option
- func WithRequestTimeout(timeout time.Duration) Option
- func WithRunFunc(fn func(context.Context, core.TaskMessage) error) Option
- func WithSubj(subj string) Option
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*options)
Option for queue system
func WithConnectTimeout ¶
WithConnectTimeout bounds the initial NATS connection attempt.
func WithRequestTimeout ¶
WithRequestTimeout sets how long Request waits for a NATS message.
func WithRunFunc ¶
WithRunFunc setup the run func of queue
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker owns a Core NATS connection and transient subscription.
func NewWorkerE ¶
NewWorkerE creates a worker and returns connection and subscription errors.
func (*Worker) BackendName ¶
BackendName identifies Core NATS in lifecycle events.
func (*Worker) Queue ¶
func (w *Worker) Queue(job core.TaskMessage) error
Queue publishes encoded bytes through the Core NATS client without a durable confirmation or handler acknowledgement. A closed worker rejects admission.