publisher

package
v2.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogPublish added in v2.7.5

func LogPublish(logger log.Logger, event interface{}, subjects []string, err error)

Types

type FlusherTimeoutOpt

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

func WithFlusherTimeout

func WithFlusherTimeout(flusherTimeout time.Duration) FlusherTimeoutOpt

type MarshalerFunc

type MarshalerFunc = func(v interface{}) ([]byte, error)

MarshalerFunc marshal struct to bytes.

type MarshalerOpt

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

func WithMarshaler

func WithMarshaler(dataMarshaler MarshalerFunc) MarshalerOpt

type Option

type Option interface {
	// contains filtered or unexported methods
}

type Publisher

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

Publisher implements a eventbus.Publisher interface.

func New

func New(conn *nats.Conn, jetstream bool, opts ...Option) (*Publisher, error)

Create publisher with existing NATS connection and proto marshaller

func (*Publisher) AddCloseFunc

func (p *Publisher) AddCloseFunc(f func())

func (*Publisher) Close

func (p *Publisher) Close()

func (*Publisher) Flush

func (p *Publisher) Flush(ctx context.Context) error

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, topics []string, groupID, aggregateID string, event eventbus.Event) error

Publish publishes an event to topics.

func (*Publisher) PublishData

func (p *Publisher) PublishData(subj string, data []byte) error

Jump to

Keyboard shortcuts

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