Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInstanceNotFound = errors.New("saga not be found")
ErrInstanceNotFound is returned by the saga store if a saga lookup by saga id returns no valid instances
Functions ¶
This section is empty.
Types ¶
type Def ¶
type Def struct {
// contains filtered or unexported fields
}
Def defines a saga type
func (*Def) HandleEvent ¶
func (sd *Def) HandleEvent(exchange, topic string, event gbus.Message, handler gbus.MessageHandler) error
HandleEvent implements HandlerRegister interface
func (*Def) HandleMessage ¶
HandleMessage implements HandlerRegister interface
type Glue ¶
Glue t/* */ies the incoming messages from the Bus with the needed Saga instances
func NewGlue ¶
func NewGlue(bus gbus.Bus, sagaStore Store, svcName string, txp gbus.TxProvider, getLog func() logrus.FieldLogger, timeoutManager gbus.TimeoutManager) *Glue
NewGlue creates a new Sagamanager
func (*Glue) RegisterSaga ¶
RegisterSaga registers the saga instance with the Bus
func (*Glue) SagaHandler ¶ added in v1.1.1
func (imsm *Glue) SagaHandler(invocation gbus.Invocation, message *gbus.BusMessage) error
SagaHandler is the generic handler invoking saga instances
type Instance ¶
type Instance struct {
ID string
ConcurrencyCtrl int
UnderlyingInstance gbus.Saga
MsgToMethodMap []*MsgToFuncPair
/*
Will hold the service name that sent the command or event that started the saga
*/
StartedBy string
/*
If this saga has been started by a message originating from another saga instance
this field will hold the saga_id of that instance
*/
StartedBySaga string
//StartedByMessageID the message-id of the message that created the saga
StartedByMessageID string
//StartedByRPCID the rpc id of the message that created the saga
StartedByRPCID string
// contains filtered or unexported fields
}
Instance represent a living instance of a saga of a particular definition
func NewInstance ¶
func NewInstance(sagaType reflect.Type, msgToMethodMap []*MsgToFuncPair) *Instance
NewInstance creates a new saga instance
type MsgToFuncPair ¶
type MsgToFuncPair struct {
Filter *gbus.MessageFilter
SagaFuncName string
}
MsgToFuncPair helper struct
type Store ¶
type Store interface {
RegisterSagaType(saga gbus.Saga)
GetSagaByID(tx *sql.Tx, sagaID string) (*Instance, error)
GetSagasByType(tx *sql.Tx, sagaType reflect.Type) ([]*Instance, error)
SaveNewSaga(tx *sql.Tx, sagaType reflect.Type, newInstance *Instance) error
UpdateSaga(tx *sql.Tx, instance *Instance) error
DeleteSaga(tx *sql.Tx, instance *Instance) error
Purge() error
}
Store abtracts the way sagas get persisted
Click to show internal directories.
Click to hide internal directories.