Skip to content

Commit

Permalink
fix(amqp): Return error when channel is closed. Fixes #920 (#925)
Browse files Browse the repository at this point in the history
* fix(amqp): Return error when channel is closed. Fixes #920

* message
  • Loading branch information
whynowy authored Nov 4, 2020
1 parent 6efb0e0 commit e64eaaa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion eventsources/sources/amqp/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ func (el *EventListener) StartListening(ctx context.Context, dispatch func([]byt
log.Info("listening to messages on channel...")
for {
select {
case msg := <-delivery:
case msg, ok := <-delivery:
if !ok {
log.Error("failed to read a message, channel might have been closed")
return errors.New("channel might have been closed")
}
log.Info("received the message", zap.Any("message-id", msg.MessageId))
body := &events.AMQPEventData{
ContentType: msg.ContentType,
Expand Down

0 comments on commit e64eaaa

Please sign in to comment.