publisher

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	ContentType string
	Body        []byte
	Opts        []PublishOption
}

func Json

func Json(body []byte) *Message

func PlainText

func PlainText(body []byte) *Message

func (*Message) WithHeader

func (m *Message) WithHeader(key string, value string) *Message

type Middleware

type Middleware func(next RoundTripper) RoundTripper

type Option

type Option func(p *Publisher)

func WithConnectionOptions

func WithConnectionOptions(connOpts ...consumer.ConnOption) Option

func WithMiddlewares

func WithMiddlewares(mws ...Middleware) Option

type PublishOption

type PublishOption = func(*frame.Frame) error

type Publisher

type Publisher struct {
	Address     string
	Queue       string
	ConnOpts    []consumer.ConnOption
	Middlewares []Middleware
	// contains filtered or unexported fields
}

func NewPublisher

func NewPublisher(address string, queue string, opts ...Option) *Publisher

func (*Publisher) Close added in v1.32.0

func (p *Publisher) Close() error

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, msg *Message) error

func (*Publisher) PublishTo

func (p *Publisher) PublishTo(ctx context.Context, queue string, msg *Message) error

type RoundTripper

type RoundTripper interface {
	Publish(ctx context.Context, queue string, msg *Message) error
}

type RoundTripperFunc

type RoundTripperFunc func(ctx context.Context, queue string, msg *Message) error

func (RoundTripperFunc) Publish

func (f RoundTripperFunc) Publish(ctx context.Context, queue string, msg *Message) error

Jump to

Keyboard shortcuts

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