{"modulePath":"github.com/benthosdev/benthos","version":"v0.26.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package input\n\nPackage input defines consumers for aggregating data from a variety of sources. All consumer types must implement interface input.Type.\n\nIf the source of an input consumer supports acknowledgements then the implementation of the input will wait for each message to reach a permanent destination before acknowledging it.\n\n## Constants\n\n```go\nconst (\n\tTypeAMQP          = \"amqp\"\n\tTypeBroker        = \"broker\"\n\tTypeDynamic       = \"dynamic\"\n\tTypeFile          = \"file\"\n\tTypeFiles         = \"files\"\n\tTypeHTTPClient    = \"http_client\"\n\tTypeHTTPServer    = \"http_server\"\n\tTypeInproc        = \"inproc\"\n\tTypeKafka         = \"kafka\"\n\tTypeKafkaBalanced = \"kafka_balanced\"\n\tTypeKinesis       = \"kinesis\"\n\tTypeMQTT          = \"mqtt\"\n\tTypeNanomsg       = \"nanomsg\"\n\tTypeNATS          = \"nats\"\n\tTypeNATSStream    = \"nats_stream\"\n\tTypeNSQ           = \"nsq\"\n\tTypeReadUntil     = \"read_until\"\n\tTypeRedisList     = \"redis_list\"\n\tTypeRedisPubSub   = \"redis_pubsub\"\n\tTypeRedisStreams  = \"redis_streams\"\n\tTypeS3            = \"s3\"\n\tTypeSQS           = \"sqs\"\n\tTypeSTDIN         = \"stdin\"\n\tTypeWebsocket     = \"websocket\"\n\tTypeZMQ4          = \"zmq4\"\n)\n```\nString constants representing each input type.\n\n## Variables\n\n```go\nvar Constructors = map[string]TypeSpec{}\n```\nConstructors is a map of all input types with their specs.\n\n```go\nvar (\n\t// ErrBrokerNoInputs is returned when creating a broker with zero inputs.\n\tErrBrokerNoInputs = errors.New(\"attempting to create broker input type with no inputs\")\n)\n```\n\n## Functions\n\n```go\nfunc Descriptions() string\n```\nDescriptions returns a formatted string of descriptions for each type.\n\n```go\nfunc SanitiseConfig(conf Config) (interface{}, error)\n```\nSanitiseConfig returns a sanitised version of the Config, meaning sections that aren't relevant to behaviour are removed.\n\n## Types\n\n```go\ntype BrokerConfig struct {\n\tCopies int             `json:\"copies\" yaml:\"copies\"`\n\tInputs brokerInputList `json:\"inputs\" yaml:\"inputs\"`\n}\n```\nBrokerConfig contains configuration fields for the Broker input type.\n\n```go\nfunc NewBrokerConfig() BrokerConfig\n```\nNewBrokerConfig creates a new BrokerConfig with default values.\n\n```go\ntype Config struct {\n\tType          string                     `json:\"type\" yaml:\"type\"`\n\tAMQP          reader.AMQPConfig          `json:\"amqp\" yaml:\"amqp\"`\n\tBroker        BrokerConfig               `json:\"broker\" yaml:\"broker\"`\n\tDynamic       DynamicConfig              `json:\"dynamic\" yaml:\"dynamic\"`\n\tFile          FileConfig                 `json:\"file\" yaml:\"file\"`\n\tFiles         reader.FilesConfig         `json:\"files\" yaml:\"files\"`\n\tHTTPClient    HTTPClientConfig           `json:\"http_client\" yaml:\"http_client\"`\n\tHTTPServer    HTTPServerConfig           `json:\"http_server\" yaml:\"http_server\"`\n\tInproc        InprocConfig               `json:\"inproc\" yaml:\"inproc\"`\n\tKafka         reader.KafkaConfig         `json:\"kafka\" yaml:\"kafka\"`\n\tKafkaBalanced reader.KafkaBalancedConfig `json:\"kafka_balanced\" yaml:\"kafka_balanced\"`\n\tKinesis       reader.KinesisConfig       `json:\"kinesis\" yaml:\"kinesis\"`\n\tMQTT          reader.MQTTConfig          `json:\"mqtt\" yaml:\"mqtt\"`\n\tNanomsg       reader.ScaleProtoConfig    `json:\"nanomsg\" yaml:\"nanomsg\"`\n\tNATS          reader.NATSConfig          `json:\"nats\" yaml:\"nats\"`\n\tNATSStream    reader.NATSStreamConfig    `json:\"nats_stream\" yaml:\"nats_stream\"`\n\tNSQ           reader.NSQConfig           `json:\"nsq\" yaml:\"nsq\"`\n\tReadUntil     ReadUntilConfig            `json:\"read_until\" yaml:\"read_until\"`\n\tRedisList     reader.RedisListConfig     `json:\"redis_list\" yaml:\"redis_list\"`\n\tRedisPubSub   reader.RedisPubSubConfig   `json:\"redis_pubsub\" yaml:\"redis_pubsub\"`\n\tRedisStreams  reader.RedisStreamsConfig  `json:\"redis_streams\" yaml:\"redis_streams\"`\n\tS3            reader.AmazonS3Config      `json:\"s3\" yaml:\"s3\"`\n\tSQS           reader.AmazonSQSConfig     `json:\"sqs\" yaml:\"sqs\"`\n\tSTDIN         STDINConfig                `json:\"stdin\" yaml:\"stdin\"`\n\tWebsocket     reader.WebsocketConfig     `json:\"websocket\" yaml:\"websocket\"`\n\tZMQ4          *reader.ZMQ4Config         `json:\"zmq4,omitempty\" yaml:\"zmq4,omitempty\"`\n\tProcessors    []processor.Config         `json:\"processors\" yaml:\"processors\"`\n}\n```\nConfig is the all encompassing configuration struct for all input types.\n\n```go\nfunc NewConfig() Config\n```\nNewConfig returns a configuration struct fully populated with default values.\n\n```go\nfunc (c *Config) UnmarshalJSON(bytes []byte) error\n```\nUnmarshalJSON ensures that when parsing configs that are in a map or slice the default values are still applied.\n\n```go\nfunc (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error\n```\nUnmarshalYAML ensures that when parsing configs that are in a map or slice the default values are still applied.\n\n```go\ntype DynamicConfig struct {\n\tInputs    map[string]Config `json:\"inputs\" yaml:\"inputs\"`\n\tPrefix    string            `json:\"prefix\" yaml:\"prefix\"`\n\tTimeoutMS int               `json:\"timeout_ms\" yaml:\"timeout_ms\"`\n}\n```\nDynamicConfig contains configuration for the Dynamic input type.\n\n```go\nfunc NewDynamicConfig() DynamicConfig\n```\nNewDynamicConfig creates a new DynamicConfig with default values.\n\n```go\ntype FileConfig struct {\n\tPath      string `json:\"path\" yaml:\"path\"`\n\tMultipart bool   `json:\"multipart\" yaml:\"multipart\"`\n\tMaxBuffer int    `json:\"max_buffer\" yaml:\"max_buffer\"`\n\tDelim     string `json:\"delimiter\" yaml:\"delimiter\"`\n}\n```\nFileConfig contains configuration values for the File input type.\n\n```go\nfunc NewFileConfig() FileConfig\n```\nNewFileConfig creates a new FileConfig with default values.\n\n```go\ntype HTTPClient struct {\n\t// contains filtered or unexported fields\n}\n```\nHTTPClient is an input type that continuously makes HTTP requests and reads the response bodies as message payloads.\n\n```go\nfunc (h *HTTPClient) CloseAsync()\n```\nCloseAsync shuts down the HTTPClient input.\n\n```go\nfunc (h *HTTPClient) TransactionChan() \u003c-chan types.Transaction\n```\nTransactionChan returns a transactions channel for consuming messages from this input type.\n\n```go\nfunc (h *HTTPClient) WaitForClose(timeout time.Duration) error\n```\nWaitForClose blocks until the HTTPClient input has closed down.\n\n```go\ntype HTTPClientConfig struct {\n\tclient.Config `json:\",inline\" yaml:\",inline\"`\n\tPayload       string       `json:\"payload\" yaml:\"payload\"`\n\tStream        StreamConfig `json:\"stream\" yaml:\"stream\"`\n}\n```\nHTTPClientConfig contains configuration for the HTTPClient output type.\n\n```go\nfunc NewHTTPClientConfig() HTTPClientConfig\n```\nNewHTTPClientConfig creates a new HTTPClientConfig with default values.\n\n```go\ntype HTTPServer struct {\n\t// contains filtered or unexported fields\n}\n```\nHTTPServer is an input type that registers a range of HTTP endpoints where requests can send messages through Benthos. The endpoints are registered on the general Benthos HTTP server by default. It is also possible to specify a custom address to bind a new server to which the endpoints will be registered on instead.\n\n```go\nfunc (h *HTTPServer) CloseAsync()\n```\nCloseAsync shuts down the HTTPServer input and stops processing requests.\n\n```go\nfunc (h *HTTPServer) TransactionChan() \u003c-chan types.Transaction\n```\nTransactionChan returns a transactions channel for consuming messages from this input.\n\n```go\nfunc (h *HTTPServer) WaitForClose(timeout time.Duration) error\n```\nWaitForClose blocks until the HTTPServer input has closed down.\n\n```go\ntype HTTPServerConfig struct {\n\tAddress   string `json:\"address\" yaml:\"address\"`\n\tPath      string `json:\"path\" yaml:\"path\"`\n\tWSPath    string `json:\"ws_path\" yaml:\"ws_path\"`\n\tTimeoutMS int64  `json:\"timeout_ms\" yaml:\"timeout_ms\"`\n\tCertFile  string `json:\"cert_file\" yaml:\"cert_file\"`\n\tKeyFile   string `json:\"key_file\" yaml:\"key_file\"`\n}\n```\nHTTPServerConfig contains configuration for the HTTPServer input type.\n\n```go\nfunc NewHTTPServerConfig() HTTPServerConfig\n```\nNewHTTPServerConfig creates a new HTTPServerConfig with default values.\n\n```go\ntype Inproc struct {\n\t// contains filtered or unexported fields\n}\n```\nInproc is an input type that reads from a named pipe, which could be the output of a separate Benthos stream of the same process.\n\n```go\nfunc (i *Inproc) CloseAsync()\n```\nCloseAsync shuts down the Inproc input and stops processing requests.\n\n```go\nfunc (i *Inproc) TransactionChan() \u003c-chan types.Transaction\n```\nTransactionChan returns a transactions channel for consuming messages from this input type.\n\n```go\nfunc (i *Inproc) WaitForClose(timeout time.Duration) error\n```\nWaitForClose blocks until the Inproc input has closed down.\n\n```go\ntype InprocConfig string\n```\nInprocConfig is a configuration type for the inproc input.\n\n```go\nfunc NewInprocConfig() InprocConfig\n```\nNewInprocConfig creates a new inproc input config.\n\n```go\ntype ReadUntil struct {\n\t// contains filtered or unexported fields\n}\n```\nReadUntil is an input type that continuously reads another input type until a condition returns true on a message consumed.\n\n```go\nfunc (r *ReadUntil) CloseAsync()\n```\nCloseAsync shuts down the ReadUntil input and stops processing requests.\n\n```go\nfunc (r *ReadUntil) TransactionChan() \u003c-chan types.Transaction\n```\nTransactionChan returns a transactions channel for consuming messages from this input type.\n\n```go\nfunc (r *ReadUntil) WaitForClose(timeout time.Duration) error\n```\nWaitForClose blocks until the ReadUntil input has closed down.\n\n```go\ntype ReadUntilConfig struct {\n\tInput     *Config          `json:\"input\" yaml:\"input\"`\n\tRestart   bool             `json:\"restart_input\" yaml:\"restart_input\"`\n\tCondition condition.Config `json:\"condition\" yaml:\"condition\"`\n}\n```\nReadUntilConfig contains configuration values for the ReadUntil input type.\n\n```go\nfunc NewReadUntilConfig() ReadUntilConfig\n```\nNewReadUntilConfig creates a new ReadUntilConfig with default values.\n\n```go\nfunc (r ReadUntilConfig) MarshalJSON() ([]byte, error)\n```\nMarshalJSON prints an empty object instead of nil.\n\n```go\nfunc (r ReadUntilConfig) MarshalYAML() (interface{}, error)\n```\nMarshalYAML prints an empty object instead of nil.\n\n```go\ntype Reader struct {\n\t// contains filtered or unexported fields\n}\n```\nReader is an input implementation that reads messages from a reader.Type.\n\n```go\nfunc (r *Reader) CloseAsync()\n```\nCloseAsync shuts down the Reader input and stops processing requests.\n\n```go\nfunc (r *Reader) TransactionChan() \u003c-chan types.Transaction\n```\nTransactionChan returns a transactions channel for consuming messages from this input type.\n\n```go\nfunc (r *Reader) WaitForClose(timeout time.Duration) error\n```\nWaitForClose blocks until the Reader input has closed down.\n\n```go\ntype STDINConfig struct {\n\tMultipart bool   `json:\"multipart\" yaml:\"multipart\"`\n\tMaxBuffer int    `json:\"max_buffer\" yaml:\"max_buffer\"`\n\tDelim     string `json:\"delimiter\" yaml:\"delimiter\"`\n}\n```\nSTDINConfig contains config fields for the STDIN input type.\n\n```go\nfunc NewSTDINConfig() STDINConfig\n```\nNewSTDINConfig creates a STDINConfig populated with default values.\n\n```go\ntype StreamConfig struct {\n\tEnabled   bool   `json:\"enabled\" yaml:\"enabled\"`\n\tReconnect bool   `json:\"reconnect\" yaml:\"reconnect\"`\n\tMultipart bool   `json:\"multipart\" yaml:\"multipart\"`\n\tMaxBuffer int    `json:\"max_buffer\" yaml:\"max_buffer\"`\n\tDelim     string `json:\"delimiter\" yaml:\"delimiter\"`\n}\n```\nStreamConfig contains fields for specifying consumption behaviour when the body of a request is a constant stream of bytes.\n\n```go\ntype Type interface {\n\ttypes.Closable\n\ttypes.Producer\n}\n```\nType is the standard interface of an input type.\n\n```go\nfunc New(\n\tconf Config,\n\tmgr types.Manager,\n\tlog log.Modular,\n\tstats metrics.Type,\n\tpipelines ...types.PipelineConstructorFunc,\n) (Type, error)\n```\nNew creates an input type based on an input configuration.\n\n```go\nfunc NewAMQP(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewAMQP creates a new AMQP input type.\n\n```go\nfunc NewAmazonS3(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewAmazonS3 creates a new AWS S3 input type.\n\n```go\nfunc NewAmazonSQS(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewAmazonSQS creates a new AWS SQS input type.\n\n```go\nfunc NewBroker(\n\tconf Config,\n\tmgr types.Manager,\n\tlog log.Modular,\n\tstats metrics.Type,\n\tpipelines ...types.PipelineConstructorFunc,\n) (Type, error)\n```\nNewBroker creates a new Broker input type.\n\n```go\nfunc NewDynamic(\n\tconf Config,\n\tmgr types.Manager,\n\tlog log.Modular,\n\tstats metrics.Type,\n\tpipelines ...types.PipelineConstructorFunc,\n) (Type, error)\n```\nNewDynamic creates a new Dynamic input type.\n\n```go\nfunc NewFile(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewFile creates a new File input type.\n\n```go\nfunc NewFiles(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewFiles creates a new Files input type.\n\n```go\nfunc NewHTTPClient(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewHTTPClient creates a new HTTPClient input type.\n\n```go\nfunc NewHTTPServer(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewHTTPServer creates a new HTTPServer input type.\n\n```go\nfunc NewInproc(\n\tconf Config,\n\tmgr types.Manager,\n\tlog log.Modular,\n\tstats metrics.Type,\n) (Type, error)\n```\nNewInproc creates a new Inproc input type.\n\n```go\nfunc NewKafka(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewKafka creates a new Kafka input type.\n\n```go\nfunc NewKafkaBalanced(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewKafkaBalanced creates a new KafkaBalanced input type.\n\n```go\nfunc NewKinesis(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewKinesis creates a new AWS Kinesis input type.\n\n```go\nfunc NewMQTT(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewMQTT creates a new MQTT input type.\n\n```go\nfunc NewNATS(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewNATS creates a new NATS input type.\n\n```go\nfunc NewNATSStream(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewNATSStream creates a new NATSStream input type.\n\n```go\nfunc NewNSQ(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewNSQ creates a new NSQ input type.\n\n```go\nfunc NewNanomsg(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewNanomsg creates a new Nanomsg input type.\n\n```go\nfunc NewReadUntil(\n\tconf Config,\n\tmgr types.Manager,\n\tlog log.Modular,\n\tstats metrics.Type,\n) (Type, error)\n```\nNewReadUntil creates a new ReadUntil input type.\n\n```go\nfunc NewReader(\n\ttypeStr string,\n\tr reader.Type,\n\tlog log.Modular,\n\tstats metrics.Type,\n) (Type, error)\n```\nNewReader creates a new Reader input type.\n\n```go\nfunc NewRedisList(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewRedisList creates a new Redis List input type.\n\n```go\nfunc NewRedisPubSub(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewRedisPubSub creates a new RedisPubSub input type.\n\n```go\nfunc NewRedisStreams(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewRedisStreams creates a new Redis List input type.\n\n```go\nfunc NewSTDIN(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewSTDIN creates a new STDIN input type.\n\n```go\nfunc NewWebsocket(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error)\n```\nNewWebsocket creates a new Websocket input type.\n\n```go\nfunc WrapWithPipelines(in Type, pipeConstructors ...types.PipelineConstructorFunc) (Type, error)\n```\nWrapWithPipelines wraps an input with a variadic number of pipelines.\n\n```go\ntype TypeSpec struct {\n\t// contains filtered or unexported fields\n}\n```\nTypeSpec is a struct containing constructors, markdown descriptions and an optional sanitisation function for each input type.\n\n```go\ntype WithPipeline struct {\n\t// contains filtered or unexported fields\n}\n```\nWithPipeline 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.\n\n```go\nfunc WrapWithPipeline(in Type, pipeConstructor types.PipelineConstructorFunc) (*WithPipeline, error)\n```\nWrapWithPipeline routes an input directly into a processing pipeline and returns a type that manages both and acts like an ordinary input.\n\n```go\nfunc (i *WithPipeline) CloseAsync()\n```\nCloseAsync triggers a closure of this object but does not block.\n\n```go\nfunc (i *WithPipeline) TransactionChan() \u003c-chan types.Transaction\n```\nTransactionChan returns the channel used for consuming transactions from this input.\n\n```go\nfunc (i *WithPipeline) WaitForClose(timeout time.Duration) error\n```\nWaitForClose is a blocking call to wait until the object has finished closing down and cleaning up resources.\n\n","path":"github.com/benthosdev/benthos/lib/input","name":"input","synopsis":"Package input defines consumers for aggregating data from a variety of sources.","isRedistributable":true}
