Documentation ¶
Overview ¶
Package nats implements the CloudEvent transport implementation using NATS.
Index ¶
- Constants
- type Codec
- type CodecStructured
- type CodecV02
- type CodecV03
- type CodecV1
- type Encoding
- type Message
- type Option
- type Transport
- func (t *Transport) HasConverter() bool
- func (t *Transport) HasTracePropagation() bool
- func (t *Transport) Send(ctx context.Context, event cloudevents.Event) (context.Context, *cloudevents.Event, error)
- func (t *Transport) SetConverter(c transport.Converter)
- func (t *Transport) SetReceiver(r transport.Receiver)
- func (t *Transport) StartReceiver(ctx context.Context) (err error)
Constants ¶
const (
// TransportName is the name of this transport.
TransportName = "NATS"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec struct { Encoding Encoding // contains filtered or unexported fields }
type CodecStructured ¶
type CodecStructured struct {
Encoding Encoding
}
CodecStructured represents an structured http transport codec for all versions. Intended to be used as a base class.
type Encoding ¶
type Encoding int32
Encoding to use for NATS transport.
const ( // Default allows NATS transport implementation to pick. Default Encoding = iota // StructuredV02 is Structured CloudEvents spec v0.2. StructuredV02 // StructuredV03 is Structured CloudEvents spec v0.3. StructuredV03 // StructuredV1 is Structured CloudEvents spec v1.0. StructuredV1 // Unknown is unknown. Unknown )
type Option ¶
Option is the function signature required to be considered an nats.Option.
func WithConnOptions ¶
func WithConnOptions(opts ...nats.Option) Option
WithConnOptions supplies NATS connection options that will be used when setting up the internal NATS connection
func WithEncoding ¶
WithEncoding sets the encoding for NATS transport.
type Transport ¶
type Transport struct { Encoding Encoding Conn *nats.Conn ConnOptions []nats.Option NatsURL string Subject string Receiver transport.Receiver // Converter is invoked if the incoming transport receives an undecodable // message. Converter transport.Converter // contains filtered or unexported fields }
Transport acts as both a NATS client and a NATS handler.
func (*Transport) HasConverter ¶
HasConverter implements Transport.HasConverter
func (*Transport) HasTracePropagation ¶
HasTracePropagation implements Transport.HasTracePropagation
func (*Transport) Send ¶
func (t *Transport) Send(ctx context.Context, event cloudevents.Event) (context.Context, *cloudevents.Event, error)
Send implements Transport.Send
func (*Transport) SetConverter ¶
SetConverter implements Transport.SetConverter
func (*Transport) SetReceiver ¶
SetReceiver implements Transport.SetReceiver