service

package
Version: v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PushResult

type PushResult struct {
	ID        uint64
	QueueName string
}

PushResult is information of pushed job except those in jobqueue.IncomingJob itself.

type RunningQueue

type RunningQueue interface {
	jobqueue.JobQueue
	PollingInterval() uint
	MaxWorkers() uint
	WorkerStats() *dispatcher.Stats
}

RunningQueue is an interface of a running queue, which is a job queue and its dispatcher combined.

type Service

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

Service is an application use case service that manages running queues.

func NewService

func NewService(repos *repository.Repositories) *Service

NewService creates a new Service instance.

func (*Service) AddJobQueue

func (s *Service) AddJobQueue(q *model.Queue) error

AddJobQueue defines a new queue and starts it.

This method is goroutine safe.

func (*Service) DeleteJobQueue

func (s *Service) DeleteJobQueue(qn string) error

DeleteJobQueue stops a running queue of name qn and removes it from the queue definition list.

This method is goroutine safe.

func (*Service) GetJobQueue

func (s *Service) GetJobQueue(qn string) (RunningQueue, bool)

GetJobQueue returns a RunningQueue of name qn. The second return value is false ff no queue is found.

This method is goroutine safe.

func (*Service) Push

func (s *Service) Push(job jobqueue.IncomingJob) (*PushResult, error)

Push pushes a job to a queue. The target queue is determined by the category of the job and defined routings.

func (*Service) Stop

func (s *Service) Stop() <-chan struct{}

Stop stops all the running queues.

This method should not be called more than once in the whole application.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL