Fix examples
This commit is contained in:
parent
5e2ce03913
commit
cf973483d5
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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{})
|
||||
|
|
Loading…
Reference in New Issue