Create kafka input

This commit is contained in:
Nicholas Wiersma
2016-12-22 09:59:48 +01:00
parent fd5118b76d
commit 1f19e550bb
5 changed files with 148 additions and 20 deletions
+3 -18
View File
@@ -2,20 +2,14 @@ package main
import (
"encoding/json"
"github.com/Shopify/sarama"
"github.com/buger/gor/proto"
"io"
"log"
"strings"
"time"
)
// KafkaConfig should contains required information to
// build producers.
type KafkaConfig struct {
host string
topic string
}
"github.com/Shopify/sarama"
"github.com/buger/gor/proto"
)
// KafkaOutput should make producer client.
type KafkaOutput struct {
@@ -23,15 +17,6 @@ type KafkaOutput struct {
producer sarama.AsyncProducer
}
// KafkaMessage should contains catched request information that should be
// passed as Json to Apache Kafka.
type KafkaMessage struct {
ReqURL string `json:"Req_URL"`
ReqMethod string `json:"Req_Method"`
ReqBody string `json:"Req_Body,omitempty"`
ReqHeaders map[string]string `json:"Req_Headers,omitempty"`
}
// KafkaOutputFrequency in milliseconds
const KafkaOutputFrequency = 500