Skip to content

Commit

Permalink
added some http-to-kafka docs
Browse files Browse the repository at this point in the history
  • Loading branch information
roblaszczak committed Nov 12, 2018
1 parent 6d55e95 commit a847fad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions _examples/http-to-kafka/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
return nil, errors.New("empty object kind")
}

// just forward from http subscribert to kafka publisher
// just forward from http subscriber to kafka publisher
return []*message.Message{msg}, nil
},
)
Expand All @@ -85,8 +85,9 @@ func main() {
}

go func() {
// HTTP server needs to be started after router is ready.
<-r.Running()
httpSubscriber.RunHTTPServer()
httpSubscriber.StartHTTPServer()
}()

r.Run()
Expand Down
4 changes: 3 additions & 1 deletion message/infrastructure/http/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ func (s *Subscriber) Subscribe(topic string) (chan *message.Message, error) {
return messages, nil
}

func (s *Subscriber) RunHTTPServer() error {
// StartHTTPServer starts http server.
// StartHTTPServer must be called after all subscribe function are called.
func (s *Subscriber) StartHTTPServer() error {
return s.server.ListenAndServe()
}

Expand Down

0 comments on commit a847fad

Please # to comment.