Documentation
¶
Overview ¶
Package queue provides the ability for Vela to integrate with different supported Queue backends.
Usage:
import "github.com/go-vela/pkg-queue/queue"
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Flags = []cli.Flag{ &cli.StringFlag{ EnvVars: []string{"QUEUE_LOG_LEVEL", "VELA_LOG_LEVEL", "LOG_LEVEL"}, Name: "queue.log.level", Usage: "set log level - options: (trace|debug|info|warn|error|fatal|panic)", Value: "info", }, &cli.StringFlag{ EnvVars: []string{"VELA_QUEUE_DRIVER", "QUEUE_DRIVER"}, Name: "queue.driver", Usage: "queue driver", }, &cli.StringFlag{ EnvVars: []string{"VELA_QUEUE_CONFIG", "QUEUE_CONFIG"}, Name: "queue.config", Usage: "queue driver configuration string", }, &cli.BoolFlag{ EnvVars: []string{"VELA_QUEUE_CLUSTER", "QUEUE_CLUSTER"}, Name: "queue.cluster", Usage: "queue client is setup for clusters", }, &cli.StringSliceFlag{ EnvVars: []string{"VELA_QUEUE_WORKER_ROUTES", "QUEUE_WORKER_ROUTES"}, Name: "queue.worker.routes", Usage: "queue worker routes is configuration for routing builds", }, }
Flags represents all supported command line interface (CLI) flags for the queue.
Functions ¶
func WithContext ¶
WithContext inserts the queue Service into the context.Context.
func WithGinContext ¶
WithGinContext inserts the queue Service into the gin.Context.
Types ¶
type Service ¶
type Service interface {
// Pop defines a function that grabs an
// item off the queue.
Pop() (*types.Item, error)
// Push defines a function that publishes an
// item to the specified route in the queue.
Push(string, []byte) error
// Route defines a function that decides which
// channel a build gets placed within the queue.
Route(*pipeline.Worker) (string, error)
}
Service represents the interface for Vela integrating with the different supported Queue backends.
func FromContext ¶
FromContext retrieves the queue Service from the context.Context.
func FromGinContext ¶
FromGinContext retrieves the queue Service from the gin.Context.
type Setup ¶
type Setup struct {
// specifies the queue driver to use
Driver string
// enables the queue client to integrate with a cluster
Cluster bool
// configuration string for the queue
Config string
// channels to listen on for the queue
Routes []string
}
Setup represents the configuration necessary for creating a Vela service capable of integrating with a configured queue environment.
func (*Setup) Kafka ¶
Kafka creates and returns a Vela engine capable of integrating with a Kafka queue.