Skip to content

Instantly share code, notes, and snippets.

@Solution
Last active December 9, 2018 13:17
Show Gist options
  • Save Solution/99ae965c80b2103d096593ad636bcc48 to your computer and use it in GitHub Desktop.
Save Solution/99ae965c80b2103d096593ad636bcc48 to your computer and use it in GitHub Desktop.
Upper part of consumer
func (c Consumer) Consume(interruptor *grupttor.Grupttor) q.ConsumeFunc {
return func(deliveries <-chan amqp.Delivery, done chan error) {
defer func() {
if r := recover(); r != nil {
err := errors.New(fmt.Sprintf("internal goroutine paniced: %v", r))
log.Error(err)
// print out the stack
log.Error(string(debug.Stack()))
done <- err
}
if interruptor.IsInterrupting() {
// everything ok, just stop
interruptor.Stop()
}
done <- nil //routine done without errors
}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment