Open mmacedoeu opened 9 years ago
We haven't figure this out yet. If you have an idea of how it should look like, can you provide an abstract code example and I'll try to implement that.
My Ideia is to close the channel and session on a shared memory, still dont know if it works cause in my way with the compiler checks:
I built a very dirty hack to do this. Just have an Arc<AtomicBool>
and set it to true to stop the consumer.
So hacky I don't want to do a pull request, but you can see the commit here: https://github.com/pimeys/rust-amqp/commit/b54c43526ac3f897971e222a649a97e169216eb5
what is the status of this?
maybe the functions used as callbacks could return different objects to stop the consuming and maybe to return some other data? maybe one could implement a "consume_once" which could be usefull for rpc for example?
also while looking into how i could stop the consuming i notized, that channel.basic_cancel doesn't remove the callback from channel..consumers... is that supposed to be so?
We don't use rabbitmq anymore, but I made a hack that worked quite well. We just switched to Kafka so it was never cleaned up and pushed to the mainline.
https://github.com/pimeys/rust-amqp/tree/consumer_clean_exit
thank you for the answer
but the cargo package still says:
description = "AMQP/RabbitMQ protocol client"
btw. i just forked and merged it here: https://github.com/Thorbijoern/rust-amqp
I could see Channel::read Will block until it reads a frame, other than
basic.deliver
or maybe get "Error reading packet from channel". I need some way to release the block state so I can handle termination like a OS signal interrupt. It's unclear for me if i need to close the channel or the connection to force it to return an error. What is the clean way to handle termination ? Could you provide a example?