tasker

package
v4.1.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyBatchs

func ApplyBatchs(batchs []TaskBatch)

ApplyBatchs applies the tasks batchs

func ApplyTasks

func ApplyTasks(batch TaskBatch) (err error)

ApplyTasks applies the task of an evaluated situation

func BuildMessageBody

func BuildMessageBody(templateBody string, templateData map[string]interface{}) ([]byte, error)

func GetSituationKnowledge

func GetSituationKnowledge(situationID int64, situationInstanceID int64, situationTS time.Time) (map[string]interface{}, error)

func ReplaceGlobals

func ReplaceGlobals(tasker *Tasker) func()

ReplaceGlobals affect a new tasker to the global manager singleton

Types

type CloseAllIssuesTask added in v4.1.3

type CloseAllIssuesTask struct {
	ID            string `json:"id"`
	StatesToClose string `json:"statesToClose"`
}

CloseAllIssuesTask struct for close issues created from the BRMS

func (CloseAllIssuesTask) GetID added in v4.1.3

func (task CloseAllIssuesTask) GetID() string

GetID returns the task key

func (CloseAllIssuesTask) Perform added in v4.1.3

func (task CloseAllIssuesTask) Perform(key string, context ContextData) error

Perform executes the task

func (CloseAllIssuesTask) String added in v4.1.3

func (task CloseAllIssuesTask) String() string

type CloseTodayIssuesTask

type CloseTodayIssuesTask struct {
	ID       string `json:"id"`
	TimeZone string `json:"timeZone"`
}

CloseTodayIssuesTask struct for close issues created in the current day from the BRMS

func (CloseTodayIssuesTask) GetID

func (task CloseTodayIssuesTask) GetID() string

GetID returns the task key

func (CloseTodayIssuesTask) Perform

func (task CloseTodayIssuesTask) Perform(key string, context ContextData) error

Perform executes the task

func (CloseTodayIssuesTask) String

func (task CloseTodayIssuesTask) String() string

type ContextData

type ContextData struct {
	SituationID        int64
	TS                 time.Time
	TemplateInstanceID int64
	RuleID             int64
	RuleVersion        int64
	CaseName           string
}

ContextData struct to represent the data related to the context in an action perform

type CreateIssueTask

type CreateIssueTask struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	Level          string `json:"level"`
	Timeout        string `json:"timeout"`
	IsNotification bool   `json:"isNotification"`
}

CreateIssueTask struct for the creation of an issue from the BRMS

func (CreateIssueTask) GetID

func (task CreateIssueTask) GetID() string

GetID returns the task key

func (CreateIssueTask) Perform

func (task CreateIssueTask) Perform(key string, context ContextData) error

Perform executes the task

func (CreateIssueTask) String

func (task CreateIssueTask) String() string

type NotifyTask

type NotifyTask struct {
	ID          string                 `json:"id"`
	Level       string                 `json:"level"`
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Timeout     string                 `json:"timeout"`
	Context     map[string]interface{} `json:"context,omitempty"`
}

NotifyTask struct to represent a notification task

func (NotifyTask) GetID

func (task NotifyTask) GetID() string

GetID returns the task key

func (NotifyTask) Perform

func (task NotifyTask) Perform(key string, context ContextData) error

Perform executes the task

func (NotifyTask) String

func (task NotifyTask) String() string

type PersistDataTask

type PersistDataTask struct {
	Data []models.MetaData
}

PersistDataTask struct to represent a persit metadata task (use to persist situation instance metadata)

func (PersistDataTask) GetID

func (task PersistDataTask) GetID() string

GetID returns the task key

func (PersistDataTask) Perform

func (task PersistDataTask) Perform(key string, context ContextData) error

Perform executes the task

func (PersistDataTask) String

func (task PersistDataTask) String() string

type SituationReportingTask

type SituationReportingTask struct {
	ID                  string   `json:"id"`
	Subject             string   `json:"subject"`
	BodyTemplate        string   `json:"bodyTemplate"`
	To                  []string `json:"to"`
	AttachmentFileNames []string `json:"attachmentFileNames"`
	AttachmentFactIDs   []int64  `json:"attachmentFactIds"`
	Columns             []string `json:"columns"`
	ColumnsLabel        []string `json:"columnsLabel"`
	Separator           rune     `json:"separator"`
	SMTPHost            string   `json:"smtpHost"`
	SMTPPort            string   `json:"smtpPort"`
	SMTPUsername        string   `json:"smtpUsername"`
	SMTPPassword        string   `json:"smtpPassword"`
	Timeout             string   `json:"timeout"`
}

SituationReportingTask struct for close issues created in the current day from the BRMS

func (SituationReportingTask) GetID

func (task SituationReportingTask) GetID() string

GetID returns the task key

func (SituationReportingTask) Perform

func (task SituationReportingTask) Perform(key string, context ContextData) error

Perform executes the task

func (SituationReportingTask) String

func (task SituationReportingTask) String() string

type Task

type Task interface {
	String() string
	GetID() string
	Perform(key string, input ContextData) error
}

Task interface of tasks

type TaskBatch

type TaskBatch struct {
	Context map[string]interface{}
	Agenda  []ruleeng.Action
}

TaskBatch batch of action to be performed

type Tasker

type Tasker struct {
	BatchReceiver chan []TaskBatch
	Close         chan struct{}
}

Tasker represents the actions router, it process the BRMS results and triggers the actions.

func NewTasker

func NewTasker() *Tasker

NewTasker renders a new Tasker

func T

func T() *Tasker

T is used to access the global tasker singleton

func (*Tasker) GetBatch

func (t *Tasker) GetBatch() []TaskBatch

GetBatch retrieve the current tasker batch

func (*Tasker) StartBatchProcessor

func (t *Tasker) StartBatchProcessor()

StartBatchProcessor starts the go routines that will listen to all the incoming batchs

func (*Tasker) StopBatchProcessor

func (t *Tasker) StopBatchProcessor()

StopBatchProcessor stops the batchprocessor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL