protocol

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WritePBMessage

func WritePBMessage(ctx context.Context, m binding.Message, pbEvt *pbv1.CloudEvent, transformers ...binding.Transformer) error

WritePBMessage fills the provided pubMessage with the message m. Using context you can tweak the encoding processing (more details on binding.Write documentation).

Types

type Message

type Message struct {
	// contains filtered or unexported fields
}

Message represents a gRPC message. This message *can* be read several times safely

func NewMessage

func NewMessage(msg *pbv1.CloudEvent) *Message

func (*Message) Finish

func (m *Message) Finish(error) error

func (*Message) GetAttribute

func (m *Message) GetAttribute(k spec.Kind) (spec.Attribute, interface{})

func (*Message) GetExtension

func (m *Message) GetExtension(name string) interface{}

func (*Message) ReadBinary

func (m *Message) ReadBinary(ctx context.Context, encoder binding.BinaryWriter) error

func (*Message) ReadEncoding

func (m *Message) ReadEncoding() binding.Encoding

func (*Message) ReadStructured

func (m *Message) ReadStructured(ctx context.Context, encoder binding.StructuredWriter) error

type Option

type Option func(*Protocol) error

Option is the function signature

func WithPublishOption

func WithPublishOption(publishOpt *PublishOption) Option

WithPublishOption sets the Publish configuration for the client. This option is required if you want to send messages.

func WithSubscribeOption

func WithSubscribeOption(subscribeOpt *SubscribeOption) Option

WithSubscribeOption sets the Subscribe configuration for the client. This option is required if you want to receive messages.

type Protocol

type Protocol struct {
	// contains filtered or unexported fields
}

func NewProtocol

func NewProtocol(clientConn grpc.ClientConnInterface, opts ...Option) (*Protocol, error)

new create grpc protocol

func (*Protocol) Close

func (p *Protocol) Close(ctx context.Context) error

func (*Protocol) OpenInbound

func (p *Protocol) OpenInbound(ctx context.Context) error

func (*Protocol) Receive

func (p *Protocol) Receive(ctx context.Context) (binding.Message, error)

Receive implements Receiver.Receive

func (*Protocol) Send

func (p *Protocol) Send(ctx context.Context, m binding.Message, transformers ...binding.Transformer) error

type PublishOption

type PublishOption struct {
	Topic string
}

PublishOption

type SubscribeOption

type SubscribeOption struct {
	Topics []string
}

SubscribeOption

Jump to

Keyboard shortcuts

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