Documentation ¶
Index ¶
- type ConsumerContext
- type ConsumerHandler
- type Context
- type DefaultEventBus
- func (e *DefaultEventBus) AddInBoundInterceptor(address string, callback func(context InterceptorContext))
- func (e *DefaultEventBus) Publish(address string, message Message)
- func (e *DefaultEventBus) Request(address string, message Message, callback func(context ConsumerContext))
- func (e *DefaultEventBus) Subscribe(address string, callback func(context ConsumerContext))
- type EventBus
- type Handler
- type InterceptorContext
- type InterceptorHandler
- type Message
- type MessageOptions
- type Publisher
- type Topic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsumerContext ¶ added in v0.5.0
type ConsumerContext struct { Ch chan Message // contains filtered or unexported fields }
func NewConsumerContext ¶ added in v0.5.0
func NewConsumerContext(ch chan Message) ConsumerContext
func (*ConsumerContext) Handle ¶ added in v0.5.0
func (d *ConsumerContext) Handle(consume func(message Message))
func (*ConsumerContext) Reply ¶ added in v0.5.0
func (d *ConsumerContext) Reply(data any)
func (*ConsumerContext) Result ¶ added in v0.5.0
func (d *ConsumerContext) Result() Message
func (ConsumerContext) SetData ¶ added in v0.5.0
func (d ConsumerContext) SetData(msg Message) ConsumerContext
type ConsumerHandler ¶ added in v0.5.0
type ConsumerHandler struct {
// contains filtered or unexported fields
}
func NewConsumer ¶ added in v0.5.0
func NewConsumer(address string, callback func(context ConsumerContext)) ConsumerHandler
func (ConsumerHandler) Chain ¶ added in v0.5.0
func (h ConsumerHandler) Chain() chan Message
func (ConsumerHandler) Closed ¶ added in v0.5.0
func (h ConsumerHandler) Closed() bool
func (ConsumerHandler) Context ¶ added in v0.5.0
func (h ConsumerHandler) Context() ConsumerContext
func (ConsumerHandler) Handle ¶ added in v0.5.0
func (h ConsumerHandler) Handle(wg *sync.WaitGroup)
type DefaultEventBus ¶
type DefaultEventBus struct {
// contains filtered or unexported fields
}
func (*DefaultEventBus) AddInBoundInterceptor ¶ added in v0.5.0
func (e *DefaultEventBus) AddInBoundInterceptor(address string, callback func(context InterceptorContext))
func (*DefaultEventBus) Publish ¶
func (e *DefaultEventBus) Publish(address string, message Message)
func (*DefaultEventBus) Request ¶
func (e *DefaultEventBus) Request(address string, message Message, callback func(context ConsumerContext))
func (*DefaultEventBus) Subscribe ¶
func (e *DefaultEventBus) Subscribe(address string, callback func(context ConsumerContext))
type EventBus ¶
type EventBus interface { Subscribe(address string, callback func(context ConsumerContext)) AddInBoundInterceptor(address string, callback func(context InterceptorContext)) Publish(address string, message Message) Request(address string, message Message, callback func(context ConsumerContext)) }
func NewEventBus ¶
func NewEventBus() EventBus
type InterceptorContext ¶ added in v0.5.0
type InterceptorContext struct {
// contains filtered or unexported fields
}
func NewInterceptorContext ¶ added in v0.5.0
func NewInterceptorContext(topic *Topic) InterceptorContext
func (*InterceptorContext) Next ¶ added in v0.5.0
func (d *InterceptorContext) Next()
func (*InterceptorContext) Result ¶ added in v0.5.0
func (d *InterceptorContext) Result() Message
func (InterceptorContext) SetData ¶ added in v0.5.0
func (d InterceptorContext) SetData(msg Message) InterceptorContext
type InterceptorHandler ¶ added in v0.5.0
type InterceptorHandler struct {
// contains filtered or unexported fields
}
func NewInterceptor ¶ added in v0.5.0
func NewInterceptor(address string, callback func(context InterceptorContext), context InterceptorContext) InterceptorHandler
func (InterceptorHandler) Chain ¶ added in v0.5.0
func (h InterceptorHandler) Chain() chan Message
func (InterceptorHandler) Closed ¶ added in v0.5.0
func (h InterceptorHandler) Closed() bool
func (InterceptorHandler) Context ¶ added in v0.5.0
func (h InterceptorHandler) Context() InterceptorContext
func (InterceptorHandler) Handle ¶ added in v0.5.0
func (h InterceptorHandler) Handle(wg *sync.WaitGroup)
type Message ¶
type Message struct { Data interface{} Options MessageOptions }
func CreateMessage ¶ added in v0.5.0
func CreateMessage() Message
func (Message) SetOptions ¶ added in v0.5.0
func (m Message) SetOptions(options MessageOptions) Message
type MessageOptions ¶
type MessageOptions struct {
// contains filtered or unexported fields
}
func NewMessageOptions ¶
func NewMessageOptions() MessageOptions
func (MessageOptions) AddHeader ¶
func (op MessageOptions) AddHeader(key string, value string) MessageOptions
func (MessageOptions) Header ¶ added in v0.5.0
func (op MessageOptions) Header(key string) string
func (MessageOptions) SetHeader ¶
func (op MessageOptions) SetHeader(headers map[string]string) MessageOptions
type Topic ¶ added in v0.5.0
func (*Topic) AddConsumer ¶ added in v0.5.0
func (t *Topic) AddConsumer(callback func(context ConsumerContext)) ConsumerHandler
func (*Topic) AddInterceptor ¶ added in v0.5.0
func (t *Topic) AddInterceptor(callback func(context InterceptorContext)) InterceptorHandler
func (*Topic) GetChannels ¶ added in v0.5.0
func (*Topic) GetHandlers ¶ added in v0.5.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.