event

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithNamePrefix added in v0.2.3

func WithNamePrefix(name string) syncOption

WithNamePrefix is used to set the name prefix for the continue event This is useful if you have multiple instance of same serive running and using a unique name for each instance make sure that each instance process their own queue of messages. Restarting the instance with the same name will make sure that the instance will continue processing the messages from the last point.

func WithSubject added in v0.0.9

func WithSubject(subject string) syncOption

Types

type Func

type Func func(ctx context.Context, evt *bus.Event) error

func FnDB

func FnDB[T any](fn func(context.Context, *T) error) Func

type FuncsMap

type FuncsMap map[string][]Func

type Sync

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

func NewSync

func NewSync(getter bus.Getter, opts ...syncOption) *Sync

func (*Sync) Continue

func (s *Sync) Continue(ctx context.Context) error

func (*Sync) IsLocked

func (s *Sync) IsLocked() bool

func (*Sync) Lock

func (s *Sync) Lock() error

func (*Sync) Once

func (s *Sync) Once(ctx context.Context, wait time.Duration) error

func (*Sync) Register

func (s *Sync) Register(subject string, fn Func)

func (*Sync) Start added in v0.2.3

func (s *Sync) Start(ctx context.Context, onceTimeout time.Duration) error

Start is a simple wrapper around Once and Continue if the context gets canceled, contine will be stopped as well

Jump to

Keyboard shortcuts

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