This commit is contained in:
“nishant-sharma”
2021-04-01 12:56:04 +05:30
parent e930b5a136
commit 0fbd842e37
6 changed files with 12 additions and 41 deletions

View File

@@ -30,6 +30,7 @@ func ClickstreamProtobufEventHandler(request RequestObject, topic string) {
messageBytes := request.Body
// to be of the format [magicByte] + [schemaID] + [messageIndex] + [value]
recordValue := []byte{}
// add [magicByte]
@@ -44,8 +45,7 @@ func ClickstreamProtobufEventHandler(request RequestObject, topic string) {
messageIndexBytes := []byte{byte(2), byte(0)}
recordValue = append(recordValue, messageIndexBytes...)
// Now write the bytes from the actual value...
// valueBytes, _ := proto.Marshal(&sensorReading)
// Now write the bytes from the actual message...
recordValue = append(recordValue, messageBytes...)
message := &sarama.ProducerMessage{
@@ -53,10 +53,6 @@ func ClickstreamProtobufEventHandler(request RequestObject, topic string) {
Value: sarama.ByteEncoder(recordValue),
}
if message != nil {
log.Printf("WRITING TO KAFKA")
}
producer_module.WriteMessageToKafkaAsync(message)
}