transport

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package transport defines the wire-level abstraction the bus uses to talk to any underlying messaging system. v0.1 ships an in-memory driver and a NATS stub; JetStream and HTTP/SSE drivers land in v0.3 and v0.2 respectively.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("transport: not implemented (v0.1 skeleton)")

ErrNotImplemented is returned by drivers whose method bodies are reserved for future milestones.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	Streaming   bool
	Persistence bool
	QueueGroup  bool
	Headers     bool
}

Capabilities advertises optional features so the bus can pick the right code path (e.g. fall back to a simulated request/reply when Streaming is false).

type Handler

type Handler func(ctx context.Context, msg *RawMessage) error

Handler is invoked once per delivered message. Implementations should treat errors as fatal for the message — drivers may log/metric them but should not retry without explicit middleware.

type Inbox

type Inbox interface {
	Subject() string
	Recv(ctx context.Context) (*RawMessage, error)
	Close() error
}

Inbox is a single-consumer ephemeral subject used for streaming responses. Subject() should be embedded in the request envelope as ReplyTo so the callee can publish multiple messages back to the caller.

type RawMessage

type RawMessage struct {
	Subject string
	Data    []byte
	Headers map[string]string
	ReplyTo string
}

RawMessage is the codec-agnostic carrier between the bus runtime and the transport. Headers stay decoupled from the payload bytes so future transports (HTTP, JetStream) can map them to their native metadata channels.

type Subscription

type Subscription interface {
	Unsubscribe() error
}

Subscription represents a live consumer registration. Closing it stops further deliveries; idempotent.

type Transport

type Transport interface {
	Connect(ctx context.Context) error
	Close() error
	Capabilities() Capabilities

	Publish(ctx context.Context, msg *RawMessage) error
	Subscribe(ctx context.Context, subject, queue string, h Handler) (Subscription, error)
	Request(ctx context.Context, msg *RawMessage) (*RawMessage, error)
	OpenInbox(ctx context.Context) (Inbox, error)
}

Transport is the contract every wire driver implements.

Directories

Path Synopsis
Package transportdial provides a convenience factory for creating a transport.Transport from environment variables.
Package transportdial provides a convenience factory for creating a transport.Transport from environment variables.
Package inmem provides an in-process Transport driver.
Package inmem provides an in-process Transport driver.
Package nats is the NATS Core driver for OpenAgentIO.
Package nats is the NATS Core driver for OpenAgentIO.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL