message-queue-go-producer

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2017 License: MIT

README

Kafka Proxy producer library

GoDoc Circle CI Go Report Card codecov

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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