event

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DisconnectTime 断开重连时间
	DisconnectTime uint = 250
)

Variables

This section is empty.

Functions

func NewEvent

func NewEvent(c *conf.Event) (mq.IMQ, error)

NewEvent 创建消息队列

Types

type KafkaEvent added in v1.2.0

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

KafkaEvent kafka event

func NewKafkaEvent added in v1.2.0

func NewKafkaEvent(c *conf.Kafka) (*KafkaEvent, error)

NewKafkaEvent 创建kafka event

func (*KafkaEvent) Close added in v1.2.0

func (k *KafkaEvent) Close()

Close 关闭

func (*KafkaEvent) Receive added in v1.2.0

func (k *KafkaEvent) Receive(topic string) <-chan *mq.Msg

Receive 接收

func (*KafkaEvent) RemoveReceiver added in v1.2.0

func (k *KafkaEvent) RemoveReceiver(topic string)

RemoveReceiver 移除监听

func (*KafkaEvent) Send added in v1.2.0

func (k *KafkaEvent) Send(_ string, _ []byte) error

Send 发送

type MqttEvent added in v1.2.0

type MqttEvent struct {
	DisconnectTime uint
	// contains filtered or unexported fields
}

MqttEvent MQTT 事件

func NewMqttEvent added in v1.2.0

func NewMqttEvent(c *conf.MQTT, opts ...MqttEventOption) (*MqttEvent, error)

NewMqttEvent 创建MQTT 事件

func (*MqttEvent) Close added in v1.2.0

func (m *MqttEvent) Close()

Close 关闭

func (*MqttEvent) Receive added in v1.2.0

func (m *MqttEvent) Receive(topic string) <-chan *mq.Msg

Receive 接收消息

func (*MqttEvent) RemoveReceiver added in v1.2.0

func (m *MqttEvent) RemoveReceiver(topic string)

RemoveReceiver 移除接收者

func (*MqttEvent) Send added in v1.2.0

func (m *MqttEvent) Send(_ string, _ []byte) error

Send 发送消息

type MqttEventOption added in v1.2.0

type MqttEventOption func(r *MqttEvent)

MqttEventOption 选项

func WithDisconnectTime added in v1.2.0

func WithDisconnectTime(quiesce uint) MqttEventOption

WithDisconnectTime 设置断开重连时间

type RocketMQEvent

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

RocketMQEvent RocketMQ事件

func NewRocketMQEvent

func NewRocketMQEvent(c *conf.RocketMQ, opts ...RocketMQEventOption) (*RocketMQEvent, error)

NewRocketMQEvent 创建RocketMQ事件

func (*RocketMQEvent) Close

func (r *RocketMQEvent) Close()

Close 关闭 mq

func (*RocketMQEvent) ConvertMessageView

func (r *RocketMQEvent) ConvertMessageView(ctx context.Context, topic string, messages []*golang.MessageView) []*mq.Msg

ConvertMessageView 转换消息视图

func (*RocketMQEvent) Receive

func (r *RocketMQEvent) Receive(topic string) <-chan *mq.Msg

Receive 监听topic

func (*RocketMQEvent) RemoveReceiver

func (r *RocketMQEvent) RemoveReceiver(topic string)

RemoveReceiver 移除监听

func (*RocketMQEvent) Send

func (r *RocketMQEvent) Send(_ string, _ []byte) error

Send 发送消息

type RocketMQEventOption

type RocketMQEventOption func(r *RocketMQEvent)

RocketMQEventOption 选项

func WithAwaitDuration

func WithAwaitDuration(d time.Duration) RocketMQEventOption

WithAwaitDuration 设置等待时间

func WithInvisibleDuration

func WithInvisibleDuration(d time.Duration) RocketMQEventOption

WithInvisibleDuration 设置不可见时间

func WithMaxMessageNum

func WithMaxMessageNum(n int32) RocketMQEventOption

WithMaxMessageNum 设置最大消息数

Jump to

Keyboard shortcuts

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