kafka_event_bus

package
v0.0.0-...-461badb Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package kafka_event_bus is a wrapper above github.com/segmentio/kafka-go Title: kafka_event_bus Files: kafka_event_bus.go

Author: Matee ullah Description: This package provides an interface implementation of EventBus for kafka. The process to work with this package involves instantiating with NewKafkaEventBus(addrs) as the first step and then calling Send(context,message..) function to publish message on the kafka topic. Send(context,message) spawns another goroutines & publishes the messages in async

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBus

type EventBus interface {
	Send(ctx context.Context, e ...interface{}) error
	Subscribe(topic string, handler func(event EventMessage) error)
}

EventBus defines an interface to deal with events delivery & subscription

func NewKafkaEventBus

func NewKafkaEventBus(brokers string) EventBus

NewKafkaEventBus creates a new kafka producer and returns client as EventBus A comma separated list of server addresses is to be passed in 'brokers'

type EventMessage

type EventMessage struct {
	Type uint
	Data []byte
}

EventMessage specifies event strcuture

type EventWithKey

type EventWithKey interface {
	EventKey() string
}

EventWithKey specifies event with key implementation

type KafkaMessage

type KafkaMessage struct {
	Topic    string
	Key      []byte
	SchemaID uint32
	Data     []byte
}

KafkaMessage is the expected argument of Send Method

type MessageBuilder

type MessageBuilder func()

MessageBuilder ...

Jump to

Keyboard shortcuts

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