Documentation ¶
Overview ¶
Package kafka provides support for Kafka message broker.
Index ¶
Constants ¶
View Source
const ( // Key defines Kafka message key. Key = "key" // Offset defines Kafka message offset. Offset = "offset" // Partition defines Kafka message partition. Partition = "partition" // Timestamp defines Kafka message timestamp. Timestamp = "timestamp" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageBroker ¶
type MessageBroker struct { Consumer sarama.Consumer // message consumer Producer sarama.SyncProducer // message producer }
MessageBroker represents message broker based on Kafka.
func NewMessageBroker ¶
NewMessageBroker creates instance of Kafka client message broker which is connected to provided addresses. Additional options passed as arguments are used to configure Kafka client and circuit breaker pattern to connect to Kafka instance. Panics if cannot create an instance (producer and/or consumer).
func (*MessageBroker) Dispose ¶
func (b *MessageBroker) Dispose()
Dispose closes Kafka client instance.
func (MessageBroker) PublishMessage ¶
PublishMessage publishes message to Kafka broker.
Click to show internal directories.
Click to hide internal directories.