Documentation
¶
Index ¶
- Variables
- func AddEventListener(handler HandlerFunc)
- func AddHandler(implName string, handler HandlerFunc)
- func AddHandlerCtx(implName string, handler HandlerFunc)
- func AddWildcardListener(handler HandlerFunc)
- func ClearBusHandlers()
- func Dispatch(msg Msg) error
- func DispatchCtx(ctx context.Context, msg Msg) error
- func InTransaction(ctx context.Context, fn func(ctx context.Context) error) error
- func Publish(msg Msg) error
- type Bus
- type CtxHandlerFunc
- type HandlerFunc
- type InProcBus
- func (b *InProcBus) AddEventListener(handler HandlerFunc)
- func (b *InProcBus) AddHandler(handler HandlerFunc)
- func (b *InProcBus) AddHandlerCtx(handler HandlerFunc)
- func (b *InProcBus) AddWildcardListener(handler HandlerFunc)
- func (b *InProcBus) Dispatch(msg Msg) error
- func (b *InProcBus) DispatchCtx(ctx context.Context, msg Msg) error
- func (b *InProcBus) InTransaction(ctx context.Context, fn func(ctx context.Context) error) error
- func (b *InProcBus) Publish(msg Msg) error
- func (b *InProcBus) SetTransactionManager(tm TransactionManager)
- type Msg
- type TransactionManager
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrHandlerNotFound = errors.New("handler not found")
Functions ¶
func AddHandlerCtx ¶
func AddHandlerCtx(implName string, handler HandlerFunc)
Package level functions
func AddWildcardListener ¶
func AddWildcardListener(handler HandlerFunc)
func ClearBusHandlers ¶
func ClearBusHandlers()
func InTransaction ¶
InTransaction starts a transaction and store it in the context. The caller can then pass a function with multiple DispatchCtx calls that all will be executed in the same transaction. InTransaction will rollback if the callback returns an error.
Types ¶
type Bus ¶
type Bus interface {
Dispatch(msg Msg) error
DispatchCtx(ctx context.Context, msg Msg) error
Publish(msg Msg) error
// InTransaction starts a transaction and store it in the context.
// The caller can then pass a function with multiple DispatchCtx calls that
// all will be executed in the same transaction. InTransaction will rollback if the
// callback returns an error.
InTransaction(ctx context.Context, fn func(ctx context.Context) error) error
AddHandler(handler HandlerFunc)
AddHandlerCtx(handler HandlerFunc)
AddEventListener(handler HandlerFunc)
AddWildcardListener(handler HandlerFunc)
// SetTransactionManager allows the user to replace the internal
// noop TransactionManager that is responsible for manageing
// transactions in `InTransaction`
SetTransactionManager(tm TransactionManager)
}
type CtxHandlerFunc ¶
type CtxHandlerFunc func()
type HandlerFunc ¶
type HandlerFunc interface{}
type InProcBus ¶
type InProcBus struct {
// contains filtered or unexported fields
}
func (*InProcBus) AddEventListener ¶
func (b *InProcBus) AddEventListener(handler HandlerFunc)
func (*InProcBus) AddHandler ¶
func (b *InProcBus) AddHandler(handler HandlerFunc)
func (*InProcBus) AddHandlerCtx ¶
func (b *InProcBus) AddHandlerCtx(handler HandlerFunc)
func (*InProcBus) AddWildcardListener ¶
func (b *InProcBus) AddWildcardListener(handler HandlerFunc)
func (*InProcBus) InTransaction ¶
func (*InProcBus) SetTransactionManager ¶
func (b *InProcBus) SetTransactionManager(tm TransactionManager)
Click to show internal directories.
Click to hide internal directories.