Open azhard4int opened 1 year ago
I'm sure you moved on from this by now, but the problem is that you spawn an 'async move' closure which tries to move to any variable it uses (one of which is consumer) into itself. What you need to do is move a copy of closure into the block.
You actually did that earlier, but you need to do it again, because there is a third context in which consumer needs to continue existing in until some indeterminate time in the future (processing thread).
It usually ends up looking like this:
tokio::spawn({
let consumer = consumer.clone();
async move {
...
}
});
let arc_consumer = Arc::new(consumer); let consumer = arc_consumer.clone();
I am trying to commit a message using Stream Consumer. But, getting the problem that consumer does not live long enough. Tried using Arc Mutex as well, but it ends up with the same error.
My code is below:
The error I am seeing is this:
Any help would be appreciated.