Documentation
¶
Index ¶
- Constants
- Variables
- type Hook
- type HookChannel
- type HookExecutor
- func (hookExecutor *HookExecutor) AddHook(hook Hook) error
- func (hookExecutor *HookExecutor) Count() int
- func (hookExecutor *HookExecutor) Execute(message *Messages.RouterMessage) (*Hook, error)
- func (hookExecutor *HookExecutor) FailedCount() int64
- func (hookExecutor *HookExecutor) GetInputChannel() chan *Messages.RouterMessage
- func (hookExecutor *HookExecutor) StartExecutor() error
- func (hookExecutor *HookExecutor) Stop() error
Constants ¶
const MaxHooksCount int = 10
maximum hooks allowed
Variables ¶
var ErrorExecutingHooks error = errors.New("failed executing hooks")
error raised when executing an hook returns an error
var ErrorMaxHooks error = errors.New("maximum hooks allowed error")
error raised when attempting to add a new hook when the maximum amount of hooks would be exceeded
var ErrorRoutineModeDisabled error = errors.New("routine mode is disabled error")
error raised when attempting to start the worker routine when not in routine mode
Functions ¶
This section is empty.
Types ¶
type Hook ¶
type Hook func(message *Messages.RouterMessage) error
type HookChannel ¶
type HookChannel chan *Messages.RouterMessage
type HookExecutor ¶
type HookExecutor struct {
// contains filtered or unexported fields
}
func CreateHookExecutor ¶
func CreateHookExecutor(routineMode bool) *HookExecutor
creates new hook executor
func (*HookExecutor) AddHook ¶
func (hookExecutor *HookExecutor) AddHook(hook Hook) error
add an hook to the executor processing queue returns ErrorMaxHooks when maximum hooks count is exceeded
func (*HookExecutor) Count ¶
func (hookExecutor *HookExecutor) Count() int
returns the count of hooks in the processing queue
func (*HookExecutor) Execute ¶
func (hookExecutor *HookExecutor) Execute(message *Messages.RouterMessage) (*Hook, error)
hooks queue executor executes all queue with passed message
func (*HookExecutor) FailedCount ¶
func (hookExecutor *HookExecutor) FailedCount() int64
returns the number of times hooks failed executing
func (*HookExecutor) GetInputChannel ¶
func (hookExecutor *HookExecutor) GetInputChannel() chan *Messages.RouterMessage
returns the messages input channel witch is used by the hook executor
func (*HookExecutor) StartExecutor ¶
func (hookExecutor *HookExecutor) StartExecutor() error
start the hook executor routine return ErrorRoutineModeDisabled if routine mode is disabled
func (*HookExecutor) Stop ¶
func (hookExecutor *HookExecutor) Stop() error
stops the executor routine