cmdworker

package
v0.0.0-...-4c7982d Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute starts the server

func ReadFile

func ReadFile(file string, id string) (string, error)

ReadFile reads content as string

func RunCommand

func RunCommand(command string, workingDir string, id string, envs []string, outWriter io.Writer) error

RunCommand executes system comman end return error if any

func StartWorkerService

func StartWorkerService(data *ServiceData) error

StartWorkerService starts the event queue listener service to listen for configured events return channel to track the finish event

to wait sync for the service to finish: fc, err := StartWorkerService(data) handle err <-fc // waits for finish

Types

type PreloadTaskManager

type PreloadTaskManager interface {
	EnsureRunning(map[string]string) error
	Close() error
}

PreloadTaskManager manages long running process, loaded by key before processing task

type RecInfoLoader

type RecInfoLoader interface {
	Get(key string) (*recognizer.Info, error)
}

RecInfoLoader loads recognizer information

type ServiceData

type ServiceData struct {
	Name       string
	Command    string
	WorkingDir string
	//ResultFile if non empty then tries to pass result to reply message from the file
	// changes {ID} in the file with message id
	ResultFile string
	//File to log into the cmd output
	LogFile        string
	ReadFunc       readFunc
	RecInfoLoader  RecInfoLoader
	PreloadManager PreloadTaskManager

	MessageSender messages.SenderWithCorr
	WorkCh        <-chan amqp.Delivery
	// contains filtered or unexported fields
}

ServiceData keeps data required for service work

Jump to

Keyboard shortcuts

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