subscriber

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoroutinePoolGoOpt

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

func WithGoPool

func WithGoPool(goroutinePoolGo eventbus.GoroutinePoolGoFunc) GoroutinePoolGoOpt

type Observer

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

Observer handles events from nats

func (*Observer) Close

func (o *Observer) Close() error

Close cancel observation and close connection to nats.

func (*Observer) SetTopics

func (o *Observer) SetTopics(_ context.Context, topics []string) error

SetTopics set new topics to observe.

type Option

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

type ReconnectFunc

type ReconnectFunc func()

ReconnectFunc called when reconnect occurs

type Subscriber

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

Subscriber implements a eventbus.Subscriber interface.

func New

func New(conn *nats.Conn, pendingLimits natsClient.PendingLimitsConfig, logger log.Logger, opts ...Option) (*Subscriber, error)

Create publisher with existing NATS connection and proto marshaller

func (*Subscriber) AddCloseFunc

func (s *Subscriber) AddCloseFunc(f func())

func (*Subscriber) AddReconnectFunc

func (s *Subscriber) AddReconnectFunc(f func()) uint64

func (*Subscriber) Close

func (s *Subscriber) Close()

func (*Subscriber) Conn

func (s *Subscriber) Conn() *nats.Conn

func (*Subscriber) RemoveReconnectFunc

func (s *Subscriber) RemoveReconnectFunc(id uint64)

func (*Subscriber) Subscribe

func (s *Subscriber) Subscribe(ctx context.Context, subscriptionID string, topics []string, eh eventbus.Handler) (eventbus.Observer, error)

Subscribe creates a observer that listen on events from topics.

type UnmarshalerFunc

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

UnmarshalerFunc unmarshal bytes to pointer of struct.

type UnmarshalerOpt

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

func WithUnmarshaler

func WithUnmarshaler(dataUnmarshaler UnmarshalerFunc) UnmarshalerOpt

Jump to

Keyboard shortcuts

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