MCPcopy
hub / github.com/IBM/sarama / main

Function main

examples/http_server/http_server.go:29–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27)
28
29func main() {
30 flag.Parse()
31
32 if *verbose {
33 sarama.Logger = log.New(os.Stdout, "[sarama] ", log.LstdFlags)
34 }
35
36 if *brokers == "" {
37 flag.PrintDefaults()
38 os.Exit(1)
39 }
40
41 brokerList := strings.Split(*brokers, ",")
42 log.Printf("Kafka brokers: %s", strings.Join(brokerList, ", "))
43
44 version, err := sarama.ParseKafkaVersion(*version)
45 if err != nil {
46 log.Panicf("Error parsing Kafka version: %v", err)
47 }
48
49 server := &Server{
50 DataCollector: newDataCollector(brokerList, version),
51 AccessLogProducer: newAccessLogProducer(brokerList, version),
52 }
53 defer func() {
54 if err := server.Close(); err != nil {
55 log.Println("Failed to close server", err)
56 }
57 }()
58
59 log.Fatal(server.Run(*addr))
60}
61
62func createTlsConfiguration() (t *tls.Config) {
63 if *certFile != "" && *keyFile != "" && *caFile != "" {

Callers

nothing calls this directly

Calls 8

CloseMethod · 0.95
RunMethod · 0.95
ParseKafkaVersionFunction · 0.92
newDataCollectorFunction · 0.85
newAccessLogProducerFunction · 0.85
FatalMethod · 0.80
PrintfMethod · 0.65
PrintlnMethod · 0.65

Tested by

no test coverage detected