v0.0.0-...-c0b5b33 Latest Latest

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

Go to latest
Published: Jan 8, 2021 License: MIT Imports: 6 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Agent

type Agent struct {
	// contains filtered or unexported fields

Agent is a struct encapuslating a runner agent that executes tasks for a specific resource. Upon dispatch, it will automatically complete the resource in the queue. It is assumed that the consumer will be familiar with the semantics of the broker and dispatcher before implementing an agent.

func New

func New(cc brokerclient.Config, resource string, dispatcher dispatcher.Table) *Agent

New constructs a new agent. Typically used inside other constructors, this sews together the dispatcher, resource and a client for future "ticking" or looping.

func (*Agent) Loop

func (a *Agent) Loop(ctx context.Context) error

Loop runs the full loop which will wait at appropriate times to avoid bombing out the service. Cancel the context to terminate it.

func (*Agent) Tick

func (a *Agent) Tick(ctx context.Context) error

Tick runs the loop iteration one time and returns any error. If there is nothing in the queue or calling complete yields an error, that will be returned. Otherwise, a status will be set based on the result of the dispatch as a part of the Complete call.


Path Synopsis

Jump to

Keyboard shortcuts

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