Version: v2.0.212+incompatible Latest Latest

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

Go to latest
Published: May 15, 2019 License: MIT Imports: 14 Imported by: 0



Package runconsumer extends consumer.Application with support for configuration and application initialization. It provides a Main() function which executes the full consumer life-cycle, including config parsing, service bootstrap, and Shard serving.



This section is empty.


This section is empty.


func Main

func Main(app Application)


type Application

type Application interface {

	// NewConfig returns a new, zero-valued Config instance.
	NewConfig() Config
	// InitApplication initializes the Application, eg by starting related
	// services and registering implemented service APIs.
	InitApplication(InitArgs) error

Application interface run by Run.

type BaseConfig

type BaseConfig struct {
	Consumer struct {

		Limit uint32 `long:"limit" env:"LIMIT" default:"32" description:"Maximum number of Shards this consumer process will allocate"`
	} `group:"Consumer" namespace:"consumer" env-namespace:"CONSUMER"`

	Broker mbp.ClientConfig `group:"Broker" namespace:"broker" env-namespace:"BROKER"`

	Etcd struct {

		Prefix string `` /* 127-byte string literal not displayed */
	} `group:"Etcd" namespace:"etcd" env-namespace:"ETCD"`

	Log         mbp.LogConfig         `group:"Logging" namespace:"log" env-namespace:"LOG"`
	Diagnostics mbp.DiagnosticsConfig `group:"Debug" namespace:"debug" env-namespace:"DEBUG"`

BaseConfig is the top-level configuration object of a Gazette consumer.

func (BaseConfig) GetBaseConfig

func (c BaseConfig) GetBaseConfig() BaseConfig

GetBaseConfig returns itself, and trivially implements the Config interface.

type Config

type Config interface {
	// GetBaseConfig of the Config.
	GetBaseConfig() BaseConfig

Config is the top-level configuration object of an Application. It must be parse-able by `go-flags`, and must present a BaseConfig.

type InitArgs

type InitArgs struct {
	// Context of the service. Typically this is context.Background(),
	// but tests may prefer to use a scoped context.
	Context context.Context
	// Config previously returned by NewConfig, and since parsed into.
	Config Config
	// Server is a dual HTTP and gRPC Server. Applications may register
	// APIs they implement against the Server mux.
	Server *server.Server
	// Service of the consumer. Applications may use the Service to power Shard
	// resolution, request proxying, and state inspection.
	Service *consumer.Service
	// Tasks are independent, cancelable goroutines having the lifetime of
	// the consumer, such as service loops and the like. Applications may
	// add additional tasks which should be started with the consumer.
	Tasks *task.Group

InitArgs are arguments passed to Application.InitApplication.

Source Files

Jump to

Keyboard shortcuts

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