writer

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2018 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package writer defines implementations of an interface for generic message writing that outputs to various third party sinks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AMQP

type AMQP struct {
	// contains filtered or unexported fields
}

AMQP is an output type that serves AMQP messages.

func NewAMQP

func NewAMQP(conf AMQPConfig, log log.Modular, stats metrics.Type) (*AMQP, error)

NewAMQP creates a new AMQP writer type.

func (*AMQP) CloseAsync

func (a *AMQP) CloseAsync()

CloseAsync shuts down the AMQP output and stops processing messages.

func (*AMQP) Connect

func (a *AMQP) Connect() error

Connect establishes a connection to an AMQP server.

func (*AMQP) WaitForClose

func (a *AMQP) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the AMQP output has closed down.

func (*AMQP) Write

func (a *AMQP) Write(msg types.Message) error

Write will attempt to write a message over AMQP, wait for acknowledgement, and returns an error if applicable.

type AMQPConfig

type AMQPConfig struct {
	URL             string                    `json:"url" yaml:"url"`
	Exchange        string                    `json:"exchange" yaml:"exchange"`
	ExchangeDeclare AMQPExchangeDeclareConfig `json:"exchange_declare" yaml:"exchange_declare"`
	BindingKey      string                    `json:"key" yaml:"key"`
	Persistent      bool                      `json:"persistent" yaml:"persistent"`
	Mandatory       bool                      `json:"mandatory" yaml:"mandatory"`
	Immediate       bool                      `json:"immediate" yaml:"immediate"`
	TLS             btls.Config               `json:"tls" yaml:"tls"`
}

AMQPConfig contains configuration fields for the AMQP output type.

func NewAMQPConfig

func NewAMQPConfig() AMQPConfig

NewAMQPConfig creates a new AMQPConfig with default values.

type AMQPExchangeDeclareConfig

type AMQPExchangeDeclareConfig struct {
	Enabled bool   `json:"enabled" yaml:"enabled"`
	Type    string `json:"type" yaml:"type"`
	Durable bool   `json:"durable" yaml:"durable"`
}

AMQPExchangeDeclareConfig contains fields indicating whether the target AMQP exchange needs to be declared, as well as any fields specifying how to accomplish that.

type AmazonAWSCredentialsConfig

type AmazonAWSCredentialsConfig struct {
	ID     string `json:"id" yaml:"id"`
	Secret string `json:"secret" yaml:"secret"`
	Token  string `json:"token" yaml:"token"`
	Role   string `json:"role" yaml:"role"`
}

AmazonAWSCredentialsConfig contains configuration params for AWS credentials.

type AmazonS3

type AmazonS3 struct {
	// contains filtered or unexported fields
}

AmazonS3 is a benthos writer.Type implementation that writes messages to an Amazon S3 bucket.

func NewAmazonS3

func NewAmazonS3(
	conf AmazonS3Config,
	log log.Modular,
	stats metrics.Type,
) *AmazonS3

NewAmazonS3 creates a new Amazon S3 bucket writer.Type.

func (*AmazonS3) CloseAsync

func (a *AmazonS3) CloseAsync()

CloseAsync begins cleaning up resources used by this reader asynchronously.

func (*AmazonS3) Connect

func (a *AmazonS3) Connect() error

Connect attempts to establish a connection to the target S3 bucket.

func (*AmazonS3) WaitForClose

func (a *AmazonS3) WaitForClose(time.Duration) error

WaitForClose will block until either the reader is closed or a specified timeout occurs.

func (*AmazonS3) Write

func (a *AmazonS3) Write(msg types.Message) error

Write attempts to write message contents to a target S3 bucket as files.

type AmazonS3Config

type AmazonS3Config struct {
	Region      string                     `json:"region" yaml:"region"`
	Bucket      string                     `json:"bucket" yaml:"bucket"`
	Path        string                     `json:"path" yaml:"path"`
	Credentials AmazonAWSCredentialsConfig `json:"credentials" yaml:"credentials"`
	TimeoutS    int64                      `json:"timeout_s" yaml:"timeout_s"`
}

AmazonS3Config contains configuration fields for the AmazonS3 output type.

func NewAmazonS3Config

func NewAmazonS3Config() AmazonS3Config

NewAmazonS3Config creates a new Config with default values.

type AmazonSQS

type AmazonSQS struct {
	// contains filtered or unexported fields
}

AmazonSQS is a benthos writer.Type implementation that writes messages to an Amazon SQS queue.

func NewAmazonSQS

func NewAmazonSQS(
	conf AmazonSQSConfig,
	log log.Modular,
	stats metrics.Type,
) *AmazonSQS

NewAmazonSQS creates a new Amazon SQS writer.Type.

func (*AmazonSQS) CloseAsync

func (a *AmazonSQS) CloseAsync()

CloseAsync begins cleaning up resources used by this reader asynchronously.

func (*AmazonSQS) Connect

func (a *AmazonSQS) Connect() error

Connect attempts to establish a connection to the target SQS queue.

func (*AmazonSQS) WaitForClose

func (a *AmazonSQS) WaitForClose(time.Duration) error

WaitForClose will block until either the reader is closed or a specified timeout occurs.

func (*AmazonSQS) Write

func (a *AmazonSQS) Write(msg types.Message) error

Write attempts to write message contents to a target SQS.

type AmazonSQSConfig

type AmazonSQSConfig struct {
	Region      string                     `json:"region" yaml:"region"`
	URL         string                     `json:"url" yaml:"url"`
	Credentials AmazonAWSCredentialsConfig `json:"credentials" yaml:"credentials"`
}

AmazonSQSConfig contains configuration fields for the output AmazonSQS type.

func NewAmazonSQSConfig

func NewAmazonSQSConfig() AmazonSQSConfig

NewAmazonSQSConfig creates a new Config with default values.

type Elasticsearch

type Elasticsearch struct {
	// contains filtered or unexported fields
}

Elasticsearch is a writer type that writes messages into elasticsearch.

func NewElasticsearch

func NewElasticsearch(conf ElasticsearchConfig, log log.Modular, stats metrics.Type) (*Elasticsearch, error)

NewElasticsearch creates a new Elasticsearch writer type.

func (*Elasticsearch) CloseAsync

func (e *Elasticsearch) CloseAsync()

CloseAsync shuts down the Elasticsearch writer and stops processing messages.

func (*Elasticsearch) Connect

func (e *Elasticsearch) Connect() error

Connect attempts to establish a connection to a Elasticsearch broker.

func (*Elasticsearch) WaitForClose

func (e *Elasticsearch) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the Elasticsearch writer has closed down.

func (*Elasticsearch) Write

func (e *Elasticsearch) Write(msg types.Message) error

Write will attempt to write a message to Elasticsearch, wait for acknowledgement, and returns an error if applicable.

type ElasticsearchConfig

type ElasticsearchConfig struct {
	URLs      []string             `json:"urls" yaml:"urls"`
	ID        string               `json:"id" yaml:"id"`
	Index     string               `json:"index" yaml:"index"`
	Type      string               `json:"type" yaml:"type"`
	TimeoutMS int                  `json:"timeout_ms" yaml:"timeout_ms"`
	Auth      auth.BasicAuthConfig `json:"basic_auth" yaml:"basic_auth"`
}

ElasticsearchConfig contains configuration fields for the Elasticsearch output type.

func NewElasticsearchConfig

func NewElasticsearchConfig() ElasticsearchConfig

NewElasticsearchConfig creates a new ElasticsearchConfig with default values.

type Files

type Files struct {
	// contains filtered or unexported fields
}

Files is a benthos writer.Type implementation that writes message parts each to their own file.

func NewFiles

func NewFiles(
	conf FilesConfig,
	log log.Modular,
	stats metrics.Type,
) *Files

NewFiles creates a new file based writer.Type.

func (*Files) CloseAsync

func (f *Files) CloseAsync()

CloseAsync begins cleaning up resources used by this reader asynchronously.

func (*Files) Connect

func (f *Files) Connect() error

Connect is a noop.

func (*Files) WaitForClose

func (f *Files) WaitForClose(time.Duration) error

WaitForClose will block until either the reader is closed or a specified timeout occurs.

func (*Files) Write

func (f *Files) Write(msg types.Message) error

Write attempts to write message contents to a directory as files.

type FilesConfig

type FilesConfig struct {
	Path string `json:"path" yaml:"path"`
}

FilesConfig contains configuration fields for the files output type.

func NewFilesConfig

func NewFilesConfig() FilesConfig

NewFilesConfig creates a new Config with default values.

type HTTPClient

type HTTPClient struct {
	// contains filtered or unexported fields
}

HTTPClient is an output type that sends messages as HTTP requests to a target server endpoint.

func NewHTTPClient

func NewHTTPClient(conf HTTPClientConfig, log log.Modular, stats metrics.Type) (*HTTPClient, error)

NewHTTPClient creates a new HTTPClient writer type.

func (*HTTPClient) CloseAsync

func (h *HTTPClient) CloseAsync()

CloseAsync shuts down the HTTPClient output and stops processing messages.

func (*HTTPClient) Connect

func (h *HTTPClient) Connect() error

Connect does nothing.

func (*HTTPClient) WaitForClose

func (h *HTTPClient) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the HTTPClient output has closed down.

func (*HTTPClient) Write

func (h *HTTPClient) Write(msg types.Message) error

Write attempts to send a message to an HTTP server, this attempt may include retries, and if all retries fail an error is returned.

type HTTPClientConfig

type HTTPClientConfig struct {
	client.Config `json:",inline" yaml:",inline"`
}

HTTPClientConfig contains configuration fields for the HTTPClient output type.

func NewHTTPClientConfig

func NewHTTPClientConfig() HTTPClientConfig

NewHTTPClientConfig creates a new HTTPClientConfig with default values.

type Kafka

type Kafka struct {
	// contains filtered or unexported fields
}

Kafka is a writer type that writes messages into kafka.

func NewKafka

func NewKafka(conf KafkaConfig, log log.Modular, stats metrics.Type) (*Kafka, error)

NewKafka creates a new Kafka writer type.

func (*Kafka) CloseAsync

func (k *Kafka) CloseAsync()

CloseAsync shuts down the Kafka writer and stops processing messages.

func (*Kafka) Connect

func (k *Kafka) Connect() error

Connect attempts to establish a connection to a Kafka broker.

func (*Kafka) WaitForClose

func (k *Kafka) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the Kafka writer has closed down.

func (*Kafka) Write

func (k *Kafka) Write(msg types.Message) error

Write will attempt to write a message to Kafka, wait for acknowledgement, and returns an error if applicable.

type KafkaConfig

type KafkaConfig struct {
	Addresses            []string    `json:"addresses" yaml:"addresses"`
	ClientID             string      `json:"client_id" yaml:"client_id"`
	Key                  string      `json:"key" yaml:"key"`
	RoundRobinPartitions bool        `json:"round_robin_partitions" yaml:"round_robin_partitions"`
	Topic                string      `json:"topic" yaml:"topic"`
	Compression          string      `json:"compression" yaml:"compression"`
	MaxMsgBytes          int         `json:"max_msg_bytes" yaml:"max_msg_bytes"`
	TimeoutMS            int         `json:"timeout_ms" yaml:"timeout_ms"`
	AckReplicas          bool        `json:"ack_replicas" yaml:"ack_replicas"`
	TargetVersion        string      `json:"target_version" yaml:"target_version"`
	TLS                  btls.Config `json:"tls" yaml:"tls"`
}

KafkaConfig contains configuration fields for the Kafka output type.

func NewKafkaConfig

func NewKafkaConfig() KafkaConfig

NewKafkaConfig creates a new KafkaConfig with default values.

type Kinesis

type Kinesis struct {
	// contains filtered or unexported fields
}

Kinesis is a benthos writer.Type implementation that writes messages to an Amazon SQS queue.

func NewKinesis

func NewKinesis(
	conf KinesisConfig,
	log log.Modular,
	stats metrics.Type,
) (*Kinesis, error)

NewKinesis creates a new Amazon SQS writer.Type.

func (*Kinesis) CloseAsync

func (a *Kinesis) CloseAsync()

CloseAsync begins cleaning up resources used by this reader asynchronously.

func (*Kinesis) Connect

func (a *Kinesis) Connect() error

Connect attempts to establish a connection to the target SQS queue.

func (*Kinesis) WaitForClose

func (a *Kinesis) WaitForClose(time.Duration) error

WaitForClose will block until either the reader is closed or a specified timeout occurs.

func (*Kinesis) Write

func (a *Kinesis) Write(msg types.Message) error

Write attempts to write message contents to a target SQS.

type KinesisConfig

type KinesisConfig struct {
	Region       string                     `json:"region" yaml:"region"`
	Stream       string                     `json:"stream" yaml:"stream"`
	HashKey      string                     `json:"hash_key" yaml:"hash_key"`
	PartitionKey string                     `json:"partition_key" yaml:"partition_key"`
	Credentials  AmazonAWSCredentialsConfig `json:"credentials" yaml:"credentials"`
}

KinesisConfig contains configuration fields for the output Kinesis type.

func NewKinesisConfig

func NewKinesisConfig() KinesisConfig

NewKinesisConfig creates a new Config with default values.

type MQTT

type MQTT struct {
	// contains filtered or unexported fields
}

MQTT is an output type that serves MQTT messages.

func NewMQTT

func NewMQTT(
	conf MQTTConfig,
	log log.Modular,
	stats metrics.Type,
) (*MQTT, error)

NewMQTT creates a new MQTT output type.

func (*MQTT) CloseAsync

func (m *MQTT) CloseAsync()

CloseAsync shuts down the MQTT output and stops processing messages.

func (*MQTT) Connect

func (m *MQTT) Connect() error

Connect establishes a connection to an MQTT server.

func (*MQTT) WaitForClose

func (m *MQTT) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the MQTT output has closed down.

func (*MQTT) Write

func (m *MQTT) Write(msg types.Message) error

Write attempts to write a message by pushing it to an MQTT broker.

type MQTTConfig

type MQTTConfig struct {
	URLs     []string `json:"urls" yaml:"urls"`
	QoS      uint8    `json:"qos" yaml:"qos"`
	Topic    string   `json:"topic" yaml:"topic"`
	ClientID string   `json:"client_id" yaml:"client_id"`
}

MQTTConfig contains configuration fields for the MQTT output type.

func NewMQTTConfig

func NewMQTTConfig() MQTTConfig

NewMQTTConfig creates a new MQTTConfig with default values.

type RedisList

type RedisList struct {
	// contains filtered or unexported fields
}

RedisList is an output type that serves RedisList messages.

func NewRedisList

func NewRedisList(
	conf RedisListConfig,
	log log.Modular,
	stats metrics.Type,
) (*RedisList, error)

NewRedisList creates a new RedisList output type.

func (*RedisList) CloseAsync

func (r *RedisList) CloseAsync()

CloseAsync shuts down the RedisList output and stops processing messages.

func (*RedisList) Connect

func (r *RedisList) Connect() error

Connect establishes a connection to an RedisList server.

func (*RedisList) WaitForClose

func (r *RedisList) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the RedisList output has closed down.

func (*RedisList) Write

func (r *RedisList) Write(msg types.Message) error

Write attempts to write a message by pushing it to the end of a Redis list.

type RedisListConfig

type RedisListConfig struct {
	URL string `json:"url" yaml:"url"`
	Key string `json:"key" yaml:"key"`
}

RedisListConfig contains configuration fields for the RedisList output type.

func NewRedisListConfig

func NewRedisListConfig() RedisListConfig

NewRedisListConfig creates a new RedisListConfig with default values.

type RedisPubSub

type RedisPubSub struct {
	// contains filtered or unexported fields
}

RedisPubSub is an output type that serves RedisPubSub messages.

func NewRedisPubSub

func NewRedisPubSub(
	conf RedisPubSubConfig,
	log log.Modular,
	stats metrics.Type,
) (*RedisPubSub, error)

NewRedisPubSub creates a new RedisPubSub output type.

func (*RedisPubSub) CloseAsync

func (r *RedisPubSub) CloseAsync()

CloseAsync shuts down the RedisPubSub output and stops processing messages.

func (*RedisPubSub) Connect

func (r *RedisPubSub) Connect() error

Connect establishes a connection to an RedisPubSub server.

func (*RedisPubSub) WaitForClose

func (r *RedisPubSub) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the RedisPubSub output has closed down.

func (*RedisPubSub) Write

func (r *RedisPubSub) Write(msg types.Message) error

Write attempts to write a message by pushing it to the end of a Redis list.

type RedisPubSubConfig

type RedisPubSubConfig struct {
	URL     string `json:"url" yaml:"url"`
	Channel string `json:"channel" yaml:"channel"`
}

RedisPubSubConfig contains configuration fields for the RedisPubSub output type.

func NewRedisPubSubConfig

func NewRedisPubSubConfig() RedisPubSubConfig

NewRedisPubSubConfig creates a new RedisPubSubConfig with default values.

type RedisStreams

type RedisStreams struct {
	// contains filtered or unexported fields
}

RedisStreams is an output type that serves RedisStreams messages.

func NewRedisStreams

func NewRedisStreams(
	conf RedisStreamsConfig,
	log log.Modular,
	stats metrics.Type,
) (*RedisStreams, error)

NewRedisStreams creates a new RedisStreams output type.

func (*RedisStreams) CloseAsync

func (r *RedisStreams) CloseAsync()

CloseAsync shuts down the RedisStreams output and stops processing messages.

func (*RedisStreams) Connect

func (r *RedisStreams) Connect() error

Connect establishes a connection to an RedisStreams server.

func (*RedisStreams) WaitForClose

func (r *RedisStreams) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the RedisStreams output has closed down.

func (*RedisStreams) Write

func (r *RedisStreams) Write(msg types.Message) error

Write attempts to write a message by pushing it to the end of a Redis list.

type RedisStreamsConfig

type RedisStreamsConfig struct {
	URL          string `json:"url" yaml:"url"`
	Stream       string `json:"stream" yaml:"stream"`
	BodyKey      string `json:"body_key" yaml:"body_key"`
	MaxLenApprox int64  `json:"max_length" yaml:"max_length"`
}

RedisStreamsConfig contains configuration fields for the RedisStreams output type.

func NewRedisStreamsConfig

func NewRedisStreamsConfig() RedisStreamsConfig

NewRedisStreamsConfig creates a new RedisStreamsConfig with default values.

type Type

type Type interface {
	// Connect attempts to establish a connection to the sink, if unsuccessful
	// returns an error. If the attempt is successful (or not necessary) returns
	// nil.
	Connect() error

	// Write should block until either the message is sent (and acknowledged) to
	// a sink, or a transport specific error has occurred, or the Type is
	// closed.
	Write(msg types.Message) error

	types.Closable
}

Type is a type that writes Benthos messages to a third party sink. If the protocol supports a form of acknowledgement then it will be returned by the call to Write.

type Websocket

type Websocket struct {
	// contains filtered or unexported fields
}

Websocket is an output type that serves Websocket messages.

func NewWebsocket

func NewWebsocket(
	conf WebsocketConfig,
	log log.Modular,
	stats metrics.Type,
) (*Websocket, error)

NewWebsocket creates a new Websocket output type.

func (*Websocket) CloseAsync

func (w *Websocket) CloseAsync()

CloseAsync shuts down the Websocket output and stops processing messages.

func (*Websocket) Connect

func (w *Websocket) Connect() error

Connect establishes a connection to an Websocket server.

func (*Websocket) WaitForClose

func (w *Websocket) WaitForClose(timeout time.Duration) error

WaitForClose blocks until the Websocket output has closed down.

func (*Websocket) Write

func (w *Websocket) Write(msg types.Message) error

Write attempts to write a message by pushing it to an Websocket broker.

type WebsocketConfig

type WebsocketConfig struct {
	URL         string `json:"url" yaml:"url"`
	auth.Config `json:",inline" yaml:",inline"`
}

WebsocketConfig contains configuration fields for the Websocket output type.

func NewWebsocketConfig

func NewWebsocketConfig() WebsocketConfig

NewWebsocketConfig creates a new WebsocketConfig with default values.

type ZMQ4Config

type ZMQ4Config struct{}

ZMQ4Config empty stub for when ZMQ4 is not compiled.

func NewZMQ4Config

func NewZMQ4Config() *ZMQ4Config

NewZMQ4Config returns nil.

Jump to

Keyboard shortcuts

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