producer

package
v0.0.0-...-b25ce53 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Workers    int
	Topic      string
	Attributes map[string]string
	Factory    *RdKafkaFactory
}

Config contains the configuration for a Counter.

type KafkaProducer

type KafkaProducer struct {
	Config

	KafkaProducer RdKafkaProducer
}

KafkaProducer send the message to a Kafka queue.

func (*KafkaProducer) OnMessage

func (kp *KafkaProducer) OnMessage(m *utils.Message, done utils.Done)

OnMessage is called when a new message is receive and send the message to a Kafka topic.

func (*KafkaProducer) Spawn

func (kp *KafkaProducer) Spawn(id int) utils.Composer

Spawn creates a new instance of a Counter worker.

func (*KafkaProducer) Workers

func (kp *KafkaProducer) Workers() int

Workers returns the number of workers.

type RdKafkaFactory

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

RdKafkaFactory is used to create multiple producers with the same attributes.

func NewRdKafkaFactory

func NewRdKafkaFactory(producer RdKafkaProducer) *RdKafkaFactory

NewRdKafkaFactory returns a new instance of a Producer Factory that always returns the same RdKafka Producer.

func (*RdKafkaFactory) CreateProducer

func (pf *RdKafkaFactory) CreateProducer() RdKafkaProducer

CreateProducer returns the internal RdKafkaProducer.

type RdKafkaProducer

type RdKafkaProducer interface {
	ProduceChannel() chan *rdkafka.Message
	Close()
}

RdKafkaProducer is an interface for rdkafka producer. Used for mocking purposes.

Jump to

Keyboard shortcuts

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