From cf973483d582200198d7fe2586821884229797e8 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Wed, 27 Jul 2016 00:05:34 +0200 Subject: [PATCH] Fix examples --- examples/daemons-kafka/daemons/number_printer.go | 4 ++-- examples/daemons-kafka/daemons/price_consumer.go | 4 ++-- examples/daemons-kafka/kafka/kafka.go | 6 +++--- examples/daemons-kafka/main.go | 5 ++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/daemons-kafka/daemons/number_printer.go b/examples/daemons-kafka/daemons/number_printer.go index e2da6d1..9b47c83 100644 --- a/examples/daemons-kafka/daemons/number_printer.go +++ b/examples/daemons-kafka/daemons/number_printer.go @@ -14,8 +14,8 @@ type NumberPrinter struct { // Startup sets up panic handler and starts enqueuing number printing jobs. func (n *NumberPrinter) Startup() { - n.HandlePanics(func(err interface{}) { - n.Logf("Oh, crap! There was a panic, take a look: %v", err) + n.HandlePanics(func(err error) { + n.Logf("Oh, crap! There was a panic, take a look: %s", err.Error()) }) n.LimitRate(3, time.Second) diff --git a/examples/daemons-kafka/daemons/price_consumer.go b/examples/daemons-kafka/daemons/price_consumer.go index 9b79e17..5497aed 100644 --- a/examples/daemons-kafka/daemons/price_consumer.go +++ b/examples/daemons-kafka/daemons/price_consumer.go @@ -3,12 +3,12 @@ package daemons import ( "time" - "github.com/localhots/shezmu" + "github.com/localhots/shezmu/consumer" ) // PriceConsumer consumes price update messages and prints them to the console. type PriceConsumer struct { - shezmu.BaseDaemon + consumer.Consumer } // PriceUpdate describes a price update message. diff --git a/examples/daemons-kafka/kafka/kafka.go b/examples/daemons-kafka/kafka/kafka.go index 6e1e1a5..a4c3246 100644 --- a/examples/daemons-kafka/kafka/kafka.go +++ b/examples/daemons-kafka/kafka/kafka.go @@ -9,7 +9,7 @@ import ( "sync" "github.com/Shopify/sarama" - "github.com/localhots/shezmu" + "github.com/localhots/shezmu/consumer" ) // ConsumerState contains data that is required to create a Kafka consumer. @@ -70,8 +70,8 @@ func Shutdown() { } } -// Subscribe creates a shezmu.Streamer implementation for Kafka messaging queue. -func (s Subscriber) Subscribe(consumerName, topic string) shezmu.Streamer { +// Subscribe creates a consumer.Streamer implementation for Kafka messaging queue. +func (s Subscriber) Subscribe(consumerName, topic string) consumer.Streamer { c, ok := consumers[consumerName] if !ok { panic(fmt.Errorf("Consumer %q has no config", consumerName)) diff --git a/examples/daemons-kafka/main.go b/examples/daemons-kafka/main.go index 08f5f38..45427d4 100644 --- a/examples/daemons-kafka/main.go +++ b/examples/daemons-kafka/main.go @@ -8,8 +8,8 @@ import ( "syscall" "github.com/localhots/shezmu" - "github.com/localhots/shezmu/example/daemons" - "github.com/localhots/shezmu/example/kafka" + "github.com/localhots/shezmu/examples/daemons-kafka/daemons" + "github.com/localhots/shezmu/examples/daemons-kafka/kafka" "github.com/localhots/shezmu/server" "github.com/localhots/shezmu/stats" ) @@ -31,7 +31,6 @@ func main() { server.Start() s := shezmu.Summon() - s.Subscriber = kafka.Subscriber{} s.DaemonStats = stats.NewGroup(statsLogger, statsServer) s.AddDaemon(&daemons.NumberPrinter{})