Documentation ¶
Overview ¶
Package nats implements the CloudEvent transport implementation using NATS.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteMsg ¶
func WriteMsg(ctx context.Context, m binding.Message, natsMessage *nats.Msg, transformers ...binding.TransformerFactory) error
Fill the provided natsMessage with the bindings.Message m. Using context you can tweak the encoding processing (more details on binding.Write documentation).
Types ¶
type Message ¶
type Message struct { Msg *nats.Msg // contains filtered or unexported fields }
Message implements binding.Message by wrapping an *nats.Msg. This message *can* be read several times safely
func NewMessage ¶
func NewMessage(msg *nats.Msg) *Message
Wrap an *nats.Msg in a binding.Message. The returned message *can* be read several times safely
func (*Message) ReadBinary ¶
func (*Message) ReadEncoding ¶
func (*Message) ReadStructured ¶
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 WithTransformer ¶
func WithTransformer(transformer binding.TransformerFactory) Option
Add a transformer, which Protocol uses while encoding a binding.Message to an nats.Message
type Protocol ¶
type Protocol struct { Conn *nats.Conn ConnOptions []nats.Option NatsURL string Subject string Transformers binding.TransformerFactories // contains filtered or unexported fields }
Protocol is a reference implementation for using the CloudEvents binding integration. Protocol acts as both a NATS client and a NATS handler.