common

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudEvent added in v1.4.0

type CloudEvent struct {
	SpecVersion     string `json:"specversion"`
	ID              string `json:"id"`
	Type            string `json:"type"`
	Source          string `json:"source"`
	DataContentType string `json:"datacontenttype"`
	Time            string `json:"time"`
	Data            string `json:"data"`
}

func NewCloudEvent added in v1.4.0

func NewCloudEvent(eventID string, eventType string, data string) *CloudEvent

func UnmarshalCloudEvent added in v1.4.0

func UnmarshalCloudEvent(data []byte) (*CloudEvent, error)

func (*CloudEvent) Marshal added in v1.4.0

func (event *CloudEvent) Marshal() ([]byte, error)

type MessageHandler

type MessageHandler func(queue MessageQueue, topic string, event *CloudEvent)

MessageHandler 消息处理函数 参数: - queue: 消息队列 - topic: 主题 - data: 消息数据 返回值: 无

type MessageQueue

type MessageQueue interface {
	Subscribe(group string, topic string, handler MessageHandler) error
	UnSubscribe(group string, topic string) error
	Publish(topic string, event *CloudEvent) error
}

MessageQueue 消息队列接口

Jump to

Keyboard shortcuts

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