-
Notifications
You must be signed in to change notification settings - Fork 89
/
producer.go
36 lines (30 loc) · 932 Bytes
/
producer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package telemetry
import (
"fmt"
logrus "github.com/teslamotors/fleet-telemetry/logger"
)
// Dispatcher type of telemetry record dispatcher
type Dispatcher string
const (
// Pubsub registers a Google pubsub dispatcher
Pubsub Dispatcher = "pubsub"
// Kafka registers a kafka dispatcher
Kafka Dispatcher = "kafka"
// Kinesis registers a kinesis publisher
Kinesis Dispatcher = "kinesis"
// Logger registers a simple logger
Logger Dispatcher = "logger"
// ZMQ registers a zmq logger
ZMQ Dispatcher = "zmq"
)
// BuildTopicName creates a topic from a namespace and a recordName
func BuildTopicName(namespace, recordName string) string {
return fmt.Sprintf("%s_%s", namespace, recordName)
}
// Producer handles dispatching data received from the vehicle
type Producer interface {
Close() error
Produce(entry *Record)
ProcessReliableAck(entry *Record)
ReportError(message string, err error, logInfo logrus.LogInfo)
}