publisher

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 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 AnyEvent

type AnyEvent interface {
	SetHeader(header string, value string)
	GetHeader(header string) []string
	GetBody() []byte
	GetDestination() string
	GetDestinationType() string
}

type NatsPublisher

type NatsPublisher[T any] struct {
	// contains filtered or unexported fields
}

func (*NatsPublisher[T]) Publish

func (n *NatsPublisher[T]) Publish(
	ctx context.Context,
	record T,
	meta common.MetaData,
	publishOptions *PublishOptions,
) error

type PublishOptions added in v1.1.0

type PublishOptions struct {
	Headers       map[string][]string
	CustomSubject string
}

type Publisher

type Publisher[T any] interface {
	Publish(
		ctx context.Context,
		record T,
		meta common.MetaData,
		headers *PublishOptions,
	) error
}

func NewNatsPublisher

func NewNatsPublisher[T any](
	con *nats.Conn,
	subject string,
	interceptors ...UnaryPublisherInterceptorFunc,
) Publisher[T]

type UnaryPublisherFunc

type UnaryPublisherFunc = func(ctx context.Context, event AnyEvent)

type UnaryPublisherInterceptorFunc

type UnaryPublisherInterceptorFunc = func(next UnaryPublisherFunc) UnaryPublisherFunc

Jump to

Keyboard shortcuts

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