Documentation ¶
Overview ¶
Package input defines consumers for aggregating data from a variety of sources. All consumer types must implement interface input.Type.
If the source of a consumer is given assurances of message receipt then the consumer must ensure that all messages read from a source are propagated to a reader before shutting down gracefully. For example, a ZMQ subscriber model based consumer would not need to provide such ensurance, a HTTP POST based consumer, however, would be expected to propagate any requests where a 200 OK message has been returned.
Index ¶
- Variables
- func Descriptions() string
- func SanitiseConfig(conf Config) (interface{}, error)
- type BrokerConfig
- type Config
- type DynamicConfig
- type FileConfig
- type HTTPClient
- type HTTPClientConfig
- type HTTPServer
- type HTTPServerConfig
- type Inproc
- type InprocConfig
- type ReadUntil
- type ReadUntilConfig
- type Reader
- type STDINConfig
- type StreamConfig
- type Type
- func New(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type, ...) (Type, error)
- func NewAMQP(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewAmazonS3(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewAmazonSQS(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewBroker(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type, ...) (Type, error)
- func NewDynamic(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type, ...) (Type, error)
- func NewFile(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewFiles(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewHTTPClient(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewHTTPServer(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewInproc(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewKafka(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewKafkaBalanced(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewMQTT(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewNATS(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewNATSStream(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewNSQ(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewReadUntil(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewReader(typeStr string, r reader.Type, log log.Modular, stats metrics.Type) (Type, error)
- func NewRedisList(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewRedisPubSub(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewSTDIN(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewScaleProto(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func NewWebsocket(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
- func WrapWithPipelines(in Type, pipeConstructors ...pipeline.ConstructorFunc) (Type, error)
- type TypeSpec
- type WithPipeline
Constants ¶
This section is empty.
Variables ¶
var Constructors = map[string]TypeSpec{}
Constructors is a map of all input types with their specs.
var ( // ErrBrokerNoInputs is returned when creating a broker with zero inputs. ErrBrokerNoInputs = errors.New("attempting to create broker input type with no inputs") )
Functions ¶
func Descriptions ¶
func Descriptions() string
Descriptions returns a formatted string of descriptions for each type.
func SanitiseConfig ¶
SanitiseConfig returns a sanitised version of the Config, meaning sections that aren't relevant to behaviour are removed.
Types ¶
type BrokerConfig ¶
type BrokerConfig struct { Copies int `json:"copies" yaml:"copies"` Inputs brokerInputList `json:"inputs" yaml:"inputs"` }
BrokerConfig is configuration for the Broker input type.
func NewBrokerConfig ¶
func NewBrokerConfig() BrokerConfig
NewBrokerConfig creates a new BrokerConfig with default values.
type Config ¶
type Config struct { Type string `json:"type" yaml:"type"` AmazonS3 reader.AmazonS3Config `json:"amazon_s3" yaml:"amazon_s3"` AmazonSQS reader.AmazonSQSConfig `json:"amazon_sqs" yaml:"amazon_sqs"` AMQP reader.AMQPConfig `json:"amqp" yaml:"amqp"` Broker BrokerConfig `json:"broker" yaml:"broker"` Dynamic DynamicConfig `json:"dynamic" yaml:"dynamic"` File FileConfig `json:"file" yaml:"file"` Files reader.FilesConfig `json:"files" yaml:"files"` HTTPClient HTTPClientConfig `json:"http_client" yaml:"http_client"` HTTPServer HTTPServerConfig `json:"http_server" yaml:"http_server"` Inproc InprocConfig `json:"inproc" yaml:"inproc"` Kafka reader.KafkaConfig `json:"kafka" yaml:"kafka"` KafkaBalanced reader.KafkaBalancedConfig `json:"kafka_balanced" yaml:"kafka_balanced"` MQTT reader.MQTTConfig `json:"mqtt" yaml:"mqtt"` NATS reader.NATSConfig `json:"nats" yaml:"nats"` NATSStream reader.NATSStreamConfig `json:"nats_stream" yaml:"nats_stream"` NSQ reader.NSQConfig `json:"nsq" yaml:"nsq"` ReadUntil ReadUntilConfig `json:"read_until" yaml:"read_until"` RedisList reader.RedisListConfig `json:"redis_list" yaml:"redis_list"` RedisPubSub reader.RedisPubSubConfig `json:"redis_pubsub" yaml:"redis_pubsub"` ScaleProto reader.ScaleProtoConfig `json:"scalability_protocols" yaml:"scalability_protocols"` STDIN STDINConfig `json:"stdin" yaml:"stdin"` Websocket reader.WebsocketConfig `json:"websocket" yaml:"websocket"` ZMQ4 *reader.ZMQ4Config `json:"zmq4,omitempty" yaml:"zmq4,omitempty"` Processors []processor.Config `json:"processors" yaml:"processors"` }
Config is the all encompassing configuration struct for all input types. Note that some configs are empty structs, as the type has no optional values but we want to list it as an option.
func NewConfig ¶
func NewConfig() Config
NewConfig returns a configuration struct fully populated with default values.
func (*Config) UnmarshalJSON ¶
UnmarshalJSON ensures that when parsing configs that are in a map or slice the default values are still applied.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML ensures that when parsing configs that are in a map or slice the default values are still applied.
type DynamicConfig ¶
type DynamicConfig struct { Inputs map[string]Config `json:"inputs" yaml:"inputs"` Prefix string `json:"prefix" yaml:"prefix"` TimeoutMS int `json:"timeout_ms" yaml:"timeout_ms"` }
DynamicConfig is configuration for the Dynamic input type.
func NewDynamicConfig ¶
func NewDynamicConfig() DynamicConfig
NewDynamicConfig creates a new DynamicConfig with default values.
type FileConfig ¶
type FileConfig struct { Path string `json:"path" yaml:"path"` Multipart bool `json:"multipart" yaml:"multipart"` MaxBuffer int `json:"max_buffer" yaml:"max_buffer"` Delim string `json:"delimiter" yaml:"delimiter"` }
FileConfig is configuration values for the File input type.
func NewFileConfig ¶
func NewFileConfig() FileConfig
NewFileConfig creates a new FileConfig with default values.
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient is an output type that pushes messages to HTTPClient.
func (*HTTPClient) CloseAsync ¶
func (h *HTTPClient) CloseAsync()
CloseAsync shuts down the HTTPClient output and stops processing messages.
func (*HTTPClient) TransactionChan ¶
func (h *HTTPClient) TransactionChan() <-chan types.Transaction
TransactionChan returns the transactions channel.
func (*HTTPClient) WaitForClose ¶
func (h *HTTPClient) WaitForClose(timeout time.Duration) error
WaitForClose blocks until the HTTPClient output has closed down.
type HTTPClientConfig ¶
type HTTPClientConfig struct { client.Config `json:",inline" yaml:",inline"` Payload string `json:"payload" yaml:"payload"` Stream StreamConfig `json:"stream" yaml:"stream"` }
HTTPClientConfig is configuration for the HTTPClient output type.
func NewHTTPClientConfig ¶
func NewHTTPClientConfig() HTTPClientConfig
NewHTTPClientConfig creates a new HTTPClientConfig with default values.
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer is an input type that serves HTTPServer POST requests.
func (*HTTPServer) CloseAsync ¶
func (h *HTTPServer) CloseAsync()
CloseAsync shuts down the HTTPServer input and stops processing requests.
func (*HTTPServer) TransactionChan ¶
func (h *HTTPServer) TransactionChan() <-chan types.Transaction
TransactionChan returns the transactions channel.
func (*HTTPServer) WaitForClose ¶
func (h *HTTPServer) WaitForClose(timeout time.Duration) error
WaitForClose blocks until the HTTPServer input has closed down.
type HTTPServerConfig ¶
type HTTPServerConfig struct { Address string `json:"address" yaml:"address"` Path string `json:"path" yaml:"path"` WSPath string `json:"ws_path" yaml:"ws_path"` TimeoutMS int64 `json:"timeout_ms" yaml:"timeout_ms"` CertFile string `json:"cert_file" yaml:"cert_file"` KeyFile string `json:"key_file" yaml:"key_file"` }
HTTPServerConfig is configuration for the HTTPServer input type.
func NewHTTPServerConfig ¶
func NewHTTPServerConfig() HTTPServerConfig
NewHTTPServerConfig creates a new HTTPServerConfig with default values.
type Inproc ¶
type Inproc struct {
// contains filtered or unexported fields
}
Inproc is an input type that reads from a named pipe.
func (*Inproc) CloseAsync ¶
func (i *Inproc) CloseAsync()
CloseAsync shuts down the Inproc input and stops processing requests.
func (*Inproc) TransactionChan ¶
func (i *Inproc) TransactionChan() <-chan types.Transaction
TransactionChan returns the transactions channel.
type InprocConfig ¶
type InprocConfig string
InprocConfig is a configuration type for the inproc input.
func NewInprocConfig ¶
func NewInprocConfig() InprocConfig
NewInprocConfig creates a new inproc input config.
type ReadUntil ¶
type ReadUntil struct {
// contains filtered or unexported fields
}
ReadUntil is an input type that reads from a ReadUntil instance.
func (*ReadUntil) CloseAsync ¶
func (r *ReadUntil) CloseAsync()
CloseAsync shuts down the ReadUntil input and stops processing requests.
func (*ReadUntil) TransactionChan ¶
func (r *ReadUntil) TransactionChan() <-chan types.Transaction
TransactionChan returns the transactions channel.
type ReadUntilConfig ¶
type ReadUntilConfig struct { Input *Config `json:"input" yaml:"input"` Restart bool `json:"restart_input" yaml:"restart_input"` Condition condition.Config `json:"condition" yaml:"condition"` }
ReadUntilConfig is configuration values for the ReadUntil input type.
func NewReadUntilConfig ¶
func NewReadUntilConfig() ReadUntilConfig
NewReadUntilConfig creates a new ReadUntilConfig with default values.
func (ReadUntilConfig) MarshalJSON ¶
func (r ReadUntilConfig) MarshalJSON() ([]byte, error)
MarshalJSON prints an empty object instead of nil.
func (ReadUntilConfig) MarshalYAML ¶
func (r ReadUntilConfig) MarshalYAML() (interface{}, error)
MarshalYAML prints an empty object instead of nil.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is an input type that reads from a Reader instance.
func (*Reader) CloseAsync ¶
func (r *Reader) CloseAsync()
CloseAsync shuts down the Reader input and stops processing requests.
func (*Reader) TransactionChan ¶
func (r *Reader) TransactionChan() <-chan types.Transaction
TransactionChan returns the transactions channel.
type STDINConfig ¶
type STDINConfig struct { Multipart bool `json:"multipart" yaml:"multipart"` MaxBuffer int `json:"max_buffer" yaml:"max_buffer"` Delim string `json:"delimiter" yaml:"delimiter"` }
STDINConfig contains config fields for the STDIN input type.
func NewSTDINConfig ¶
func NewSTDINConfig() STDINConfig
NewSTDINConfig creates a STDINConfig populated with default values.
type StreamConfig ¶
type StreamConfig struct { Enabled bool `json:"enabled" yaml:"enabled"` Reconnect bool `json:"reconnect" yaml:"reconnect"` Multipart bool `json:"multipart" yaml:"multipart"` MaxBuffer int `json:"max_buffer" yaml:"max_buffer"` Delim string `json:"delimiter" yaml:"delimiter"` }
StreamConfig contains fields for specifiying stream consumption behaviour.
type Type ¶
Type is the standard interface of an input type.
func New ¶
func New( conf Config, mgr types.Manager, log log.Modular, stats metrics.Type, pipelines ...pipeline.ConstructorFunc, ) (Type, error)
New creates an input type based on an input configuration.
func NewAmazonS3 ¶
NewAmazonS3 creates a new amazon S3 input type.
func NewAmazonSQS ¶
func NewAmazonSQS(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
NewAmazonSQS creates a new Amazon SQS input type.
func NewBroker ¶
func NewBroker( conf Config, mgr types.Manager, log log.Modular, stats metrics.Type, pipelines ...pipeline.ConstructorFunc, ) (Type, error)
NewBroker creates a new Broker input type.
func NewDynamic ¶
func NewDynamic( conf Config, mgr types.Manager, log log.Modular, stats metrics.Type, pipelines ...pipeline.ConstructorFunc, ) (Type, error)
NewDynamic creates a new Dynamic input type.
func NewHTTPClient ¶
func NewHTTPClient(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
NewHTTPClient creates a new HTTPClient output type.
func NewHTTPServer ¶
func NewHTTPServer(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
NewHTTPServer creates a new HTTPServer input type.
func NewInproc ¶
func NewInproc( conf Config, mgr types.Manager, log log.Modular, stats metrics.Type, ) (Type, error)
NewInproc creates a new Inproc input type.
func NewKafkaBalanced ¶
func NewKafkaBalanced(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
NewKafkaBalanced creates a new KafkaBalanced input type.
func NewNATSStream ¶
func NewNATSStream(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
NewNATSStream creates a new NATSStream input type.
func NewReadUntil ¶
func NewReadUntil( conf Config, mgr types.Manager, log log.Modular, stats metrics.Type, ) (Type, error)
NewReadUntil creates a new ReadUntil input type.
func NewRedisList ¶
func NewRedisList(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
NewRedisList creates a new Redis List input type.
func NewRedisPubSub ¶
func NewRedisPubSub(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
NewRedisPubSub creates a new RedisPubSub input type.
func NewScaleProto ¶
func NewScaleProto(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
NewScaleProto creates a new ScaleProto input type.
func NewWebsocket ¶
func NewWebsocket(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)
NewWebsocket creates a new Websocket input type.
func WrapWithPipelines ¶
func WrapWithPipelines(in Type, pipeConstructors ...pipeline.ConstructorFunc) (Type, error)
WrapWithPipelines wraps an input with a variadic number of pipelines.
type TypeSpec ¶
type TypeSpec struct {
// contains filtered or unexported fields
}
TypeSpec is a constructor and a usage description for each input type.
type WithPipeline ¶
type WithPipeline struct {
// contains filtered or unexported fields
}
WithPipeline is a type that wraps both an input type and a pipeline type by routing the input through the pipeline, and implements the input.Type interface in order to act like an ordinary input.
func WrapWithPipeline ¶
func WrapWithPipeline(in Type, pipeConstructor pipeline.ConstructorFunc) (*WithPipeline, error)
WrapWithPipeline routes an input directly into a processing pipeline and returns a type that manages both and acts like an ordinary input.
func (*WithPipeline) CloseAsync ¶
func (i *WithPipeline) CloseAsync()
CloseAsync triggers a closure of this object but does not block.
func (*WithPipeline) TransactionChan ¶
func (i *WithPipeline) TransactionChan() <-chan types.Transaction
TransactionChan returns the channel used for consuming transactions from this input.
func (*WithPipeline) WaitForClose ¶
func (i *WithPipeline) WaitForClose(timeout time.Duration) error
WaitForClose is a blocking call to wait until the object has finished closing down and cleaning up resources.
Source Files ¶
- amazon_s3.go
- amazon_sqs.go
- amqp.go
- broker.go
- constructor.go
- dynamic.go
- file.go
- files.go
- http_client.go
- http_server.go
- inproc.go
- interface.go
- kafka.go
- kafka_balanced.go
- mqtt.go
- nats.go
- nats_stream.go
- nsq.go
- package.go
- read_until.go
- reader.go
- redis_list.go
- redis_pubsub.go
- scale_proto.go
- stdin.go
- websocket.go
- wrap_with_pipeline.go