producers

package
v0.0.0-...-754aeae Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoConnection - you should check connection to producer
	ErrNoConnection = errors.New("no connection")
)

Functions

This section is empty.

Types

type ElasticProducer

type ElasticProducer struct {
	Name  string
	Index string
	// contains filtered or unexported fields
}

ElasticProducer - send pacakges to ElasticSearch

func NewElastic

func NewElastic(elasticUrl, entityName string) (*ElasticProducer, error)

NewElastic - constructor

func (*ElasticProducer) GetName

func (p *ElasticProducer) GetName() string

GetName - getter

func (*ElasticProducer) Produce

func (p *ElasticProducer) Produce(uid string, data []byte)

Produce - package indexing

func (*ElasticProducer) Validate

func (p *ElasticProducer) Validate(pkg data.Package) error

Validate - can valdiate pacakages, if you need to.

type HttpProducer

type HttpProducer struct {
	Name string
	Url  string
}

HttpProducer - send pacakges to external url

func NewHttp

func NewHttp(url string) *HttpProducer

NewHttp - constructor

func (*HttpProducer) GetName

func (p *HttpProducer) GetName() string

GetName - getter

func (*HttpProducer) Produce

func (p *HttpProducer) Produce(uid string, data []byte)

Produce - package sending

func (*HttpProducer) Validate

func (p *HttpProducer) Validate(pkg data.Package) error

Validate - findout if we need to send it, also fill empty fields

type KafkaProducer

type KafkaProducer struct {
	Name  string
	Topic string
	// contains filtered or unexported fields
}

KafkaProducer - send packages to Apache Kafka

func NewKafka

func NewKafka(kafkaUrl, entityName string) (*KafkaProducer, error)

NewKafka - constructor

func (*KafkaProducer) GetName

func (p *KafkaProducer) GetName() string

GetName - getter

func (*KafkaProducer) Produce

func (p *KafkaProducer) Produce(uid string, data []byte)

Produce - package indexing

func (*KafkaProducer) Validate

func (p *KafkaProducer) Validate(pkg data.Package) error

Validate - can valdiate pacakages, if you need to.

type Producer

type Producer interface {
	GetName() string
	Validate(data.Package) error
	Produce(string, []byte)
}

Producer - common interface for package producers

func Gather

func Gather(externalUrl, elasticUrl, kafkaUrl string) []Producer

Gather - collect all avalilable producers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳