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 ¶
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 ¶
EventMessage specifies event strcuture
type EventWithKey ¶
type EventWithKey interface {
EventKey() string
}
EventWithKey specifies event with key implementation
type KafkaMessage ¶
KafkaMessage is the expected argument of Send Method