amqp: Consumers with a consumer tag of "" cannot be canceled.

queue := "my-queue"
consumer := "" // bad
channel.Consume(queue, consumer, .....)

When the consumer is empty, later invocations to cancel using the empty string don’t cause the consumer to be cancelled. It doesn’t matter whether the noWait argument for Cancel is true or false.

I suspect the problem is found in the dictionary lookup ch, found := me.chans[tag] inside of the consumers.go file in the close function.

The workaround for the time being is to have a consumer name that’s populated.

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Reactions: 1
  • Comments: 20 (2 by maintainers)

Most upvoted comments

@harry-me how does that question have anything to do with this issue or client?

We already explained it on rabbitmq-users but let’s take another round: consumers can only be cancelled on the same channel they were added on. Consumer tag => consumer map is a part of channel state.