streamconfig

package
v2.0.0-beta.0+incompat... Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2018 License: ISC Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConsumerDefaults = Consumer{
	Logger:                             *zap.NewNop(),
	HandleInterrupt:                    true,
	Name:                               "consumer",
	AllowEnvironmentBasedConfiguration: true,
}

ConsumerDefaults holds the default values for Consumer.

View Source
var ProducerDefaults = Producer{
	Logger:                             *zap.NewNop(),
	HandleInterrupt:                    true,
	Name:                               "producer",
	AllowEnvironmentBasedConfiguration: true,
}

ProducerDefaults holds the default values for Producer.

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	Inmem          inmemconfig.Consumer
	Kafka          kafkaconfig.Consumer
	Pubsub         pubsubconfig.Consumer
	Standardstream standardstreamconfig.Consumer

	// Logger is the configurable logger instance to log messages. If left
	// undefined, a no-op logger will be used.
	Logger zap.Logger `ignored:"true"`

	// HandleInterrupt determines whether the consumer should close itself
	// gracefully when an interrupt signal (^C) is received. This defaults to true
	// to increase first-time ease-of-use, but if the application wants to handle
	// these signals manually, this flag disables the automated implementation.
	HandleInterrupt bool `ignored:"true"`

	// Name is the name of the current processor. It is currently only used to
	// determine the prefix for environment-variable based configuration values.
	// For example, if Name is set to `MyProcessor`, then all environment
	// variable-based configurations need to start with `MYPROCESSOR_`. If no name
	// is set, then the prefix is "consumer" is used, so you prepend all
	// environment variables with "CONSUMER_.
	Name string `ignored:"true"`

	// AllowEnvironmentBasedConfiguration allows you to disable configuring the
	// stream client based on predefined environment variables. This is enabled by
	// default, but can be disabled if you want full control over the behavior of
	// the stream client without any outside influence.
	AllowEnvironmentBasedConfiguration bool `ignored:"true"`
}

Consumer contains the configuration for all the different consumer that implement the stream.Consumer interface. When a consumer is instantiated, these options can be passed into the new consumer to determine its behavior. If the consumer only has to support a single implementation of the interface, then all other configuration values can be ignored.

func NewConsumer

func NewConsumer(options ...func(*Consumer)) (Consumer, error)

NewConsumer returns a new Consumer configuration struct, containing the values passed into the function. If any error occurs during configuration validation, an error is returned as the second argument.

func TestNewConsumer

func TestNewConsumer(tb testing.TB, defaults bool, options ...func(*Consumer)) Consumer

TestNewConsumer returns a new consumer configuration struct, optionally with the default values removed.

func (Consumer) Usage

func (c Consumer) Usage() []byte

Usage calls the usage() function and returns a byte array.

type Producer

type Producer struct {
	Inmem          inmemconfig.Producer
	Kafka          kafkaconfig.Producer
	Pubsub         pubsubconfig.Producer
	Standardstream standardstreamconfig.Producer

	// Logger is the configurable logger instance to log messages. If left
	// undefined, a no-op logger will be used.
	Logger zap.Logger `ignored:"true"`

	// HandleInterrupt determines whether the producer should close itself
	// gracefully when an interrupt signal (^C) is received. This defaults to true
	// to increase first-time ease-of-use, but if the application wants to handle
	// these signals manually, this flag disables the automated implementation.
	HandleInterrupt bool `ignored:"true"`

	// Name is the name of the current processor. It is currently only used to
	// determine the prefix for environment-variable based configuration values.
	// For example, if Name is set to `MyProcessor`, then all environment
	// variable-based configurations need to start with `MYPROCESSOR_`.If no name
	// is set, then the prefix is "producer" is used, so you prepend all
	// environment variables with "PRODUCER_.
	Name string `ignored:"true"`

	// AllowEnvironmentBasedConfiguration allows you to disable configuring the
	// stream client based on predefined environment variables. This is enabled by
	// default, but can be disabled if you want full control over the behavior of
	// the stream client without any outside influence.
	AllowEnvironmentBasedConfiguration bool `ignored:"true"`
}

Producer contains the configuration for all the different consumer that implement the stream.Producer interface. When a producer is instantiated, these options can be passed into the new producer to determine its behavior. If the producer only has to support a single implementation of the interface, then all other configuration values can be ignored.

func NewProducer

func NewProducer(options ...func(*Producer)) (Producer, error)

NewProducer returns a new Producer configuration struct, containing the values passed into the function. If any error occurs during configuration validation, an error is returned as the second argument.

func TestNewProducer

func TestNewProducer(tb testing.TB, defaults bool, options ...func(*Producer)) Producer

TestNewProducer returns a new producer configuration struct, optionally with the default values removed.

func (Producer) Usage

func (p Producer) Usage() []byte

Usage calls the usage() function and returns a byte array.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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