Kafka Proxy producer library
Responsible for writing messages to kafka, through the kafka proxy
Go implementation of https://github.com/Financial-Times/message-queue-producer library
Usage
go get github.com/Financial-Times/message-queue-go-producer/producer
import github.com/Financial-Times/message-queue-go-producer/producer
The Api allows two ways of writing in kafka:
- SendMessage(msg Message) - accepts a Message having a map of headers and a message body, converts it to a standard FT raw message (string representation), and stores it in Kafka
- SendRawMessage(msg string) - capable of storing plain string messages
Creating a producer is based on a producer configuration. The client should create a producer instance, based on config settings.
conf := queueProducer.MessageProducerConfig{
Addr: "<producerHost>",
Topic: "<topic>",
Queue: "<required in co-co - producerHostHeader>",
Authorization: "<setting vulcand authorization header in coco>",
}
producerInstance = queueProducer.NewMessageProducer(producerConfig)
producerInstance.SendMessage(uuid, queueProducer.Message{Headers: msg.Headers, Body: msg.Body})
Build
go build ./producer
go test ./producer