events

package
v0.0.0-...-0cd273a Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KafkaClient *cluster.Client

KafkaClient holds kafka connection details to be used by consumers and producers

Functions

func Init

func Init()

Init configures and starts our kafka client (used to create consumers and producers)

func LaunchConsumer

func LaunchConsumer()

LaunchConsumer creates a Kafka Consumer that listens for incoming messages

func LaunchProducer

func LaunchProducer()

LaunchProducer creates a Kafka Producer that translates outbound messages

Types

type EventConsumer

type EventConsumer struct {
	ClusterConsumer *cluster.Consumer
}

EventConsumer is a custom struct that encapsulates cluster's Consumer this is for mockability and result tracking during testing

var Consumer *EventConsumer

Consumer will be our runtime object for consuming messages

func (*EventConsumer) Init

func (s *EventConsumer) Init() (err error)

Init initializes our ClusterConsumer to consume our configured topics

func (*EventConsumer) Listen

func (s *EventConsumer) Listen()

Listen will be in charge of commiting offsets reporting errors and calling relevant controllers

type EventProducer

type EventProducer struct {
	AsyncProducer sarama.AsyncProducer
	Successes     int64
	Errors        int64
	Topic         string
}

EventProducer is a custom struct that encapsulates sarama's Producer this is for mockability and result tracking during testing

var Producer *EventProducer

Producer will be our runtime object for producing messages

func (*EventProducer) HandleIncoming

func (s *EventProducer) HandleIncoming()

HandleIncoming counts and reports both errors and successes

func (*EventProducer) Init

func (s *EventProducer) Init() (err error)

Init initializes out AsyncProducer

func (*EventProducer) Outbound

func (s *EventProducer) Outbound(msg *user.Event) error

Outbound receives a user.Event and produces it to the kafka queue

Jump to

Keyboard shortcuts

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