task

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskCtxKeyTitle         = "Title"
	TaskCtxKeyErrorOccurred = "ErrorOccurred"

	TaskCtxKeyTaskID              = "Task.TaskID"
	TaskCtxKeyTaskCommandID       = "Task.TaskCommandID"
	TaskCtxKeyTaskInstanceID      = "Task.TaskInstanceID"
	TaskCtxKeyElapsedTimeAfterRun = "Task.ElapsedTimeAfterRun"
)
View Source
const (
	// TaskID
	TidAlganicMall TaskID = "ALGANICMALL" // 엘가닉몰(http://www.alganicmall.com/)

	// TaskCommandID
	TcidAlganicMallWatchNewEvents TaskCommandID = "WatchNewEvents" // 엘가닉몰 신규 이벤트 확인
	TcidAlganicMallWatchAtoCream  TaskCommandID = "WatchAtoCream"  // 엘가닉몰 아토크림 정보 변경 확인
)
View Source
const (
	// TaskID
	TidCovid19 TaskID = "COVID19"

	// TaskCommandID
	TcidCovid19WatchResidualVaccine TaskCommandID = "WatchResidualVaccine" // 코로나19 잔여백신 확인
)
View Source
const (
	// TaskID
	TidJdc TaskID = "JDC" // 전남디지털역량교육(http://전남디지털역량.com/)

	// TaskCommandID
	TcidJdcWatchNewOnlineEducation TaskCommandID = "WatchNewOnlineEducation" // 신규 비대면 온라인 특별/정규교육 확인
)
View Source
const (
	// TaskID
	TidJyiu TaskID = "JYIU" // 전남여수산학융합원(https://www.jyiu.or.kr/)

	// TaskCommandID
	TcidJyiuWatchNewNotice    TaskCommandID = "WatchNewNotice"    // 전남여수산학융합원 공지사항 새글 확인
	TcidJyiuWatchNewEducation TaskCommandID = "WatchNewEducation" // 전남여수산학융합원 신규 교육프로그램 확인
)
View Source
const (
	// TaskID
	TidLotto TaskID = "LOTTO"

	// TaskCommandID
	TcidLottoPrediction TaskCommandID = "Prediction" // 로또 번호 예측
)
View Source
const (
	// TaskID
	TidNaver TaskID = "NAVER" // 네이버

	// TaskCommandID
	TcidNaverWatchNewPerformances TaskCommandID = "WatchNewPerformances" // 네이버 신규 공연정보 확인
)

Variables

View Source
var (
	ErrNotSupportedTask               = errors.New("지원되지 않는 작업입니다")
	ErrNotSupportedCommand            = errors.New("지원되지 않는 작업 커맨드입니다")
	ErrNoImplementationForTaskCommand = errors.New("작업 커맨드에 대한 구현이 없습니다")
)

Functions

This section is empty.

Types

type TaskCommandID

type TaskCommandID string

type TaskContext

type TaskContext interface {
	With(key, val interface{}) TaskContext
	WithTask(taskID TaskID, taskCommandID TaskCommandID) TaskContext
	WithInstanceID(taskInstanceID TaskInstanceID, elapsedTimeAfterRun int64) TaskContext
	WithError() TaskContext
	Value(key interface{}) interface{}
}

TaskContext

func NewContext

func NewContext() TaskContext

type TaskID

type TaskID string
const (

	// TaskID
	TidNaverShopping TaskID = "NS" // 네이버쇼핑(https://shopping.naver.com/)

	// TaskCommandID
	TcidNaverShoppingWatchPriceAny = TaskCommandID(naverShoppingWatchPriceTaskCommandIDPrefix + taskCommandIDAnyString) // 네이버쇼핑 가격 확인

)

type TaskInstanceID

type TaskInstanceID string

type TaskNotificationSender

type TaskNotificationSender interface {
	NotifyToDefault(message string) bool
	NotifyWithTaskContext(notifierID string, message string, taskCtx TaskContext) bool

	SupportHTMLMessage(notifierID string) bool
}

TaskNotificationSender

type TaskRunBy

type TaskRunBy int
const (
	TaskRunByUser TaskRunBy = iota
	TaskRunByScheduler
)

type TaskRunner

type TaskRunner interface {
	TaskRun(taskID TaskID, taskCommandID TaskCommandID, notifierID string, notifyResultOfTaskRunRequest bool, taskRunBy TaskRunBy) (succeeded bool)
	TaskRunWithContext(taskID TaskID, taskCommandID TaskCommandID, taskCtx TaskContext, notifierID string, notifyResultOfTaskRunRequest bool, taskRunBy TaskRunBy) (succeeded bool)
	TaskCancel(taskInstanceID TaskInstanceID) (succeeded bool)
}

TaskRunner

type TaskService

type TaskService struct {
	// contains filtered or unexported fields
}

TaskService

func NewService

func NewService(config *g.AppConfig) *TaskService

func (*TaskService) Run

func (s *TaskService) Run(serviceStopCtx context.Context, serviceStopWaiter *sync.WaitGroup)

func (*TaskService) SetTaskNotificationSender

func (s *TaskService) SetTaskNotificationSender(taskNotificiationSender TaskNotificationSender)

func (*TaskService) TaskCancel

func (s *TaskService) TaskCancel(taskInstanceID TaskInstanceID) (succeeded bool)

func (*TaskService) TaskRun

func (s *TaskService) TaskRun(taskID TaskID, taskCommandID TaskCommandID, notifierID string, notifyResultOfTaskRunRequest bool, taskRunBy TaskRunBy) (succeeded bool)

func (*TaskService) TaskRunWithContext

func (s *TaskService) TaskRunWithContext(taskID TaskID, taskCommandID TaskCommandID, taskCtx TaskContext, notifierID string, notifyResultOfTaskRunRequest bool, taskRunBy TaskRunBy) (succeeded bool)

Jump to

Keyboard shortcuts

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