Documentation
¶
Overview ¶
Package natsbroker provides a NATS adapter for runtime/contracts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker publishes contract events to a NATS subject and can receive them from a synchronous subscription. It implements contracts.Broker and contracts.EventSource.
func (*Broker) PublishEvents ¶
PublishEvents publishes event envelopes to the configured subject.
func (*Broker) ReceiveEventBatch ¶
ReceiveEventBatch receives up to the configured batch size. Core NATS acknowledgements are implicit, so returned batches do not include ack hooks.
type Decoder ¶
type Decoder func(json.RawMessage) (any, error)
Decoder converts one JSON event value into the typed value expected by runtime/contracts subscribers.
type Option ¶
type Option func(*Broker)
Option configures a Broker.
func WithBatchSize ¶
WithBatchSize sets the max messages returned per receive call.
func WithDecoder ¶
WithDecoder registers a decoder for one event type.
func WithJSONDecoder ¶
WithJSONDecoder registers a JSON decoder for one event type.
func WithTimeout ¶
WithTimeout sets the max wait for one message.