cqrs

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDynamicSubscription

func AddDynamicSubscription[TH event.IDynamicIntegrationEventHandler](eventName string)

func AddSubscription

func AddSubscription[T event.IntegrationEvent, TH event.IntegrationEventHandler[T]]()

func RemoveDynamicSubscription

func RemoveDynamicSubscription(eventName string)

func RemoveSubscription

func RemoveSubscription[T event.IntegrationEvent]()

Types

type EventBusConfig

type EventBusConfig struct {

	// 错误重试次数
	Retry int
	// 发布事件前触发
	OnPublishBefore OnEventSendFn
	// 发布事件后触发
	OnPublishAfter OnEventSendFn
	// 内部错误
	OnError OnEventErrorFn
	// 序列化器
	Marshaler Marshaler
}

type IEventBus

type IEventBus interface {
}

IEventBus 事件基本模型

type IEventBusSubscriptionsManager

type IEventBusSubscriptionsManager struct {
	OnEventRemoved map[string]chan int
	// contains filtered or unexported fields
}
var SubscriptionsManager *IEventBusSubscriptionsManager

func (*IEventBusSubscriptionsManager) Clear

func (c *IEventBusSubscriptionsManager) Clear()

func (*IEventBusSubscriptionsManager) GetEventType

func (c *IEventBusSubscriptionsManager) GetEventType(eventName string) reflect.Type

func (*IEventBusSubscriptionsManager) GetHandler

func (c *IEventBusSubscriptionsManager) GetHandler(eventName string) *SubscriptionInfo

func (*IEventBusSubscriptionsManager) IsEmpty

func (c *IEventBusSubscriptionsManager) IsEmpty() bool

type JsonMarshaler

type JsonMarshaler struct{}

func (JsonMarshaler) Marshal

func (m JsonMarshaler) Marshal(data interface{}) ([]byte, string, error)

func (JsonMarshaler) Unmarshal

func (JsonMarshaler) Unmarshal(e *message.Message, v reflect.Value) (err error)

type Marshaler

type Marshaler interface {
	Marshal(v interface{}) ([]byte, string, error)
	Unmarshal(msg *message.Message, v reflect.Value) (err error)
}

type OnEventErrorFn

type OnEventErrorFn func(params OnEventErrorParams)

type OnEventErrorParams

type OnEventErrorParams struct {
	UId       string
	EventName string
	Message   *message.Message
	Time      time.Time
	Err       error
}

type OnEventSendFn

type OnEventSendFn func(params OnEventSendParams) error

type OnEventSendParams

type OnEventSendParams struct {
	UId       uuid.UUID
	EventName string
	Message   *message.Message
	// contains filtered or unexported fields
}

type ProtobufMarshaler

type ProtobufMarshaler struct{}

func (ProtobufMarshaler) Marshal

func (m ProtobufMarshaler) Marshal(data interface{}) ([]byte, string, error)

func (ProtobufMarshaler) Unmarshal

func (ProtobufMarshaler) Unmarshal(e *message.Message, v reflect.Value) (err error)

type SubscriptionInfo

type SubscriptionInfo struct {
	IsDynamic   bool
	HandlerType reflect.Type
}

func (SubscriptionInfo) Dynamic

func (c SubscriptionInfo) Dynamic(h reflect.Type)

func (SubscriptionInfo) Typed

func (c SubscriptionInfo) Typed(h reflect.Type)

Directories

Path Synopsis
contrib
pb

Jump to

Keyboard shortcuts

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