tasker

package
v5.3.11 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 16 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 ReplaceGlobals

func ReplaceGlobals(tasker *Tasker) func()

ReplaceGlobals affect a new tasker to the global manager singleton

Types

type CloseAllIssuesTask

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

CloseAllIssuesTask struct for close issues created from the BRMS

func (CloseAllIssuesTask) GetID

func (task CloseAllIssuesTask) GetID() string

GetID returns the task key

func (CloseAllIssuesTask) Perform

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

Perform executes the task

func (CloseAllIssuesTask) String

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 {
	RuleID                      int64
	RuleVersion                 int64
	CaseName                    string
	SituationID                 int64
	TemplateInstanceID          int64
	TS                          time.Time
	HistorySituationFlattenData map[string]interface{}
	SituationHistoryID          int64
}

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

func BuildContextData

func BuildContextData(inputs ...map[string]interface{}) ContextData

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 SituationReportingTask

type SituationReportingTask struct {
	ID                  string          `json:"id"`
	IssueID             string          `json:"issueId"`
	Subject             string          `json:"subject"`
	BodyTemplate        string          `json:"bodyTemplate"`
	To                  []string        `json:"to"`
	AttachmentFileNames []string        `json:"attachmentFileNames"`
	AttachmentFactIDs   []int64         `json:"attachmentFactIds"`
	Columns             []export.Column `json:"columns"`
	Separator           rune            `json:"separator"`
	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