Skip to content

Commit

Permalink
Methods for stopping default consumer and producer
Browse files Browse the repository at this point in the history
  • Loading branch information
crackcomm committed Mar 20, 2017
1 parent f2c4cb1 commit 6ee4382
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions consumer/default.go
Expand Up @@ -26,3 +26,8 @@ func Register(topic, channel string, maxInFlight int, fnc Handler) error {
func Start(debug bool) {
DefaultConsumer.Start(debug)
}

// Stop - Look for Consumer.Stop() (on default consumer)
func Stop() {
DefaultConsumer.Stop()
}
5 changes: 5 additions & 0 deletions producer/default.go
Expand Up @@ -50,3 +50,8 @@ func Connect(addr string) error {
func ConnectConfig(addr string, config *nsq.Config) error {
return DefaultProducer.ConnectConfig(addr, config)
}

// Stop initiates a graceful stop of the Producer (permanent)
func Stop() {
DefaultProducer.Stop()
}

0 comments on commit 6ee4382

Please sign in to comment.