event

package
v0.0.0-...-0025a43 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	Queue() string
	Value() []byte
	DelaySeconds() int64
	Unmarshal(value []byte) Event
}

Event 消息事件

type ExampleEvent

type ExampleEvent struct {
	Desc  string
	Delay int64
}

func (*ExampleEvent) DelaySeconds

func (e *ExampleEvent) DelaySeconds() int64

func (*ExampleEvent) Queue

func (e *ExampleEvent) Queue() string

func (*ExampleEvent) Unmarshal

func (e *ExampleEvent) Unmarshal(value []byte) Event

func (*ExampleEvent) Value

func (e *ExampleEvent) Value() []byte

type Handler

type Handler func(context.Context, Event) error

Handler 消息处理

type Receiver

type Receiver interface {
	Receive(ctx context.Context, msg Event, handler Handler, workerNum int64) error
	Close() error
}

Receiver 消息接收者

type Sender

type Sender interface {
	Send(context.Context, Event) error
	Close() error
}

Sender 消息生产者

Jump to

Keyboard shortcuts

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