Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EventMetadataToMap ¶ added in v0.2.0
func EventMetadataToMap(em *EventMetadata) map[string]string
EventMetadataToMap 将 EventMetadata 转换为 map[string]string
Types ¶
type EventBus ¶
type EventBus interface {
Publish(ctx context.Context, topic string, payload []byte, metadata map[string]string) error
Subscribe(ctx context.Context, topic string, handler EventHandler) error
}
EventBus 接口定义
type EventHandler ¶
type EventMetadata ¶ added in v0.2.0
type EventMetadata struct {
//EventID string `json:"event_id"` // UUID
EventType string `json:"event_type"`
TenantID uint32 `json:"tenant_id"`
UserID uint32 `json:"user_id"`
TaskID uint32 `json:"task_id"` // 执行任务WorkTaskID
WorkTaskID uint32 `json:"work_task_id"`
CompanyID uint32 `json:"company_id"`
CompanyName string `json:"company_name"`
}
EventMetadata 事件元数据,结果入库用
func MapToEventMetadata ¶ added in v0.2.0
func MapToEventMetadata(m map[string]string) (*EventMetadata, error)
type RabbitMQEventBus ¶
type RabbitMQEventBus struct {
// contains filtered or unexported fields
}
RabbitMQEventBus 实现
func (*RabbitMQEventBus) Publish ¶
func (e *RabbitMQEventBus) Publish(ctx context.Context, topic string, payload []byte, metadata map[string]string) error
Publish 发布事件
func (*RabbitMQEventBus) Subscribe ¶
func (e *RabbitMQEventBus) Subscribe(ctx context.Context, topic string, handler EventHandler) error
Subscribe 订阅事件,并发消费,并发度与 PrefetchCount 一致
type TaskPayload ¶ added in v0.2.0
type TaskPayload struct {
OssPath string `json:"oss_path"`
Options interface{} `json:"options,omitempty"`
}
TaskPayload 任务信息,启动任务用
Click to show internal directories.
Click to hide internal directories.