Documentation
¶
Overview ¶
Package nats profiles core NATS publish and subscription handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Publish sends payload to subject.
Publish(string, []byte) error
// PublishMsg sends a prepared NATS message.
PublishMsg(*nats.Msg) error
// Subscribe registers a handler for subject.
Subscribe(string, nats.MsgHandler) (*nats.Subscription, error)
// QueueSubscribe registers a queue-group handler for subject.
QueueSubscribe(string, string, nats.MsgHandler) (*nats.Subscription, error)
}
Client is the core NATS API wrapped by Profile. Retain the original *nats.Conn for lifecycle and APIs outside this focused interface.
type ProfiledClient ¶
type ProfiledClient interface {
Client
// PublishContext publishes while correlating the dispatch with ctx.
PublishContext(context.Context, string, []byte) error
}
ProfiledClient adds a context-aware publish operation for request correlation while preserving the wrapped core NATS API.
func Profile ¶
func Profile(client Client, configs ...Config) ProfiledClient
Profile wraps client with the default profiler. It returns nil for a nil client and otherwise preserves core NATS operations.
func ProfileWith ¶
func ProfileWith(p *webpprof.Profiler, client Client, configs ...Config) ProfiledClient
ProfileWith wraps client with p. When p is nil, operations still delegate to client but no entries are recorded.
Click to show internal directories.
Click to hide internal directories.