Documentation
¶
Overview ¶
Package nats is the NATS Core driver for OpenAgentIO.
It maps the transport contract onto github.com/nats-io/nats.go: Publish, Subscribe (with optional queue groups), Request/Reply, and ephemeral _INBOX-backed Inbox for streaming responses.
Index ¶
- type Driver
- func (*Driver) Capabilities() transport.Capabilities
- func (d *Driver) Close() error
- func (d *Driver) Connect(_ context.Context) error
- func (d *Driver) Flush() error
- func (d *Driver) OpenInbox(_ context.Context) (transport.Inbox, error)
- func (d *Driver) Publish(_ context.Context, msg *transport.RawMessage) error
- func (d *Driver) Request(ctx context.Context, msg *transport.RawMessage) (*transport.RawMessage, error)
- func (d *Driver) Subscribe(_ context.Context, subject, queue string, h transport.Handler) (transport.Subscription, error)
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is the NATS Core transport. The zero value is unusable; construct with New and call Connect before any Publish/Subscribe/Request.
func (*Driver) Capabilities ¶
func (*Driver) Capabilities() transport.Capabilities
Capabilities advertises NATS Core features. Persistence is false; durable streams are reserved for the future JetStream driver (v0.3).
func (*Driver) Close ¶
Close drains the connection so in-flight handlers complete, then releases the cancel context handed to subscription handlers. Idempotent.
func (*Driver) Connect ¶
Connect establishes the underlying NATS connection. Idempotent: a second call while already connected is a no-op.
func (*Driver) Flush ¶
Flush blocks until the server has acknowledged all queued protocol writes. Useful before exiting a process to ensure the last Publish actually hit the wire, and in tests to make a Subscribe + Publish on different connections race-free.
func (*Driver) Request ¶
func (d *Driver) Request(ctx context.Context, msg *transport.RawMessage) (*transport.RawMessage, error)