Documentation
¶
Index ¶
- type Engine
- type EngineBase
- func (e *EngineBase) Execute(cmd msgbus.Command, bus *msgbus.MsgBus)
- func (e *EngineBase) Notifier() *msgbus.StateNotifier
- func (e *EngineBase) NotifyAbnormal(errorCode int)
- func (e *EngineBase) NotifyFinished()
- func (e *EngineBase) NotifyReady()
- func (e *EngineBase) NotifyStop()
- func (e *EngineBase) SetNotifier(notifier *msgbus.StateNotifier)
- func (e *EngineBase) Type() common.EngineType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine interface {
// Type returns the engine type identifier
Type() common.EngineType
// Lifecycle methods
Start()
Stop()
// Execute methods
Execute(cmd msgbus.Command, bus *msgbus.MsgBus)
// State notification methods
NotifyReady()
NotifyStop()
NotifyFinished()
NotifyAbnormal(errorCode int)
}
Engine is the common interface for all engines in the system. It defines lifecycle methods and state notification capabilities.
type EngineBase ¶
type EngineBase struct {
// contains filtered or unexported fields
}
EngineBase provides common functionality for all engines. Embed this in concrete engine implementations to get state notification support.
func NewEngineBase ¶
func NewEngineBase(engineType common.EngineType) EngineBase
NewEngineBase creates a new EngineBase with the given engine type. The notifier should be set via SetNotifier before calling notification methods.
func (*EngineBase) Execute ¶
func (e *EngineBase) Execute(cmd msgbus.Command, bus *msgbus.MsgBus)
Process a command by dispatching to typed callbacks. Override the specific typed callbacks (ProcessOrderSubmitCmd, ProcessOrderCancelCmd, etc.) in your engine implementation.
func (*EngineBase) Notifier ¶
func (e *EngineBase) Notifier() *msgbus.StateNotifier
Notifier returns the StateNotifier for this engine.
func (*EngineBase) NotifyAbnormal ¶
func (e *EngineBase) NotifyAbnormal(errorCode int)
NotifyAbnormal publishes an AbnormalEvent indicating this engine encountered an error.
func (*EngineBase) NotifyFinished ¶
func (e *EngineBase) NotifyFinished()
NotifyFinished publishes a FinishedEvent indicating this engine has finished.
func (*EngineBase) NotifyReady ¶
func (e *EngineBase) NotifyReady()
NotifyReady publishes a ReadyEvent indicating this engine is ready.
func (*EngineBase) NotifyStop ¶
func (e *EngineBase) NotifyStop()
NotifyStop publishes a StopEvent indicating this engine is stopping.
func (*EngineBase) SetNotifier ¶
func (e *EngineBase) SetNotifier(notifier *msgbus.StateNotifier)
SetNotifier sets the StateNotifier for this engine. This must be called before any notification methods are used.
func (*EngineBase) Type ¶
func (e *EngineBase) Type() common.EngineType
Type returns the engine type identifier.