achilleasa / dart_amqp

Dart AMQP client implementing protocol version 0.9.1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Channel Exceptions, Channel Closes, etc don't inform Consumers

rajmaniar opened this issue · comments

When a channel exception is thrown or channel is closed the Consumer's error or done callbacks are not invoked.

Consider:

var c = Client();
var chan = await c.channel();
var queue = await chan.queue("test123", autoDelete: true);
var consumer = await queue.consume(noAck: true);
consumer.listen((event) {print("queue: $event");}, onDone: (){print("consumer done");}, onError: (e){print("consumer error: $e");}, cancelOnError: true);

try {
    await chan.queue("test456", passive: true);
 } on QueueNotFoundException {
    print("QueueNotFoundException will break the channel");
}
await Future.delayed(Duration(seconds: 60));

In the above scenario the consumer done or consumer error are never emitted and the stream isn't closed.

It seems to me the channel exception handler should loop over all the consumer stream controllers, pass the error down and/or close the streams.

Thanks for reporting this! A fix is on the way.