Open mix911 opened 5 years ago
Are you trying to receive a message, then spawn a task (creating a new thread), then acknowledge the message after the task is complete? It's what we're trying to achieve and it's not clear what is a correct way to do so.
Is it possible to have two amqp_connection_state_t objects and use them like this:
It would be nice to get some help, thanks!
Are you trying to receive a message, then spawn a task (creating a new thread), then acknowledge the message after the task is complete? It's what we're trying to achieve and it's not clear what is a correct way to do so.
Is it possible to have two amqp_connection_state_t objects and use them like this:
- Receive the message using the first connection, process it in another thread (without use of this connection).
- Acknowledge the message using second connection (which exists in some other thread) using same delivery tag.
It would be nice to get some help, thanks!
Hi AgelessDick!
The idea seems witty, might be it will even work. But still the question is, does it correct to use two amqp_connection_state_t and use it in the way that was described? Will it work in the future? It's not clear from available documentation.
Are you trying to receive a message, then spawn a task (creating a new thread), then acknowledge the message after the task is complete? It's what we're trying to achieve and it's not clear what is a correct way to do so.
Is it possible to have two amqp_connection_state_t objects and use them like this:
- Receive the message using the first connection, process it in another thread (without use of this connection).
- Acknowledge the message using second connection (which exists in some other thread) using same delivery tag.
It would be nice to get some help, thanks!
I have the same problem. Is your method effective?
Hello!
The point is, that if something went wrong during handling a message it won't be acknowledged, so we will have the second attempt on the next iteration. But the problem is that we have to spend some significant time on handling a message, so the thread will be unable to consume another message. I believe it is clear why handling a message in another thread isn't a solution, according to the library description it won't work, because "You cannot share a socket, an amqp_connection_state_t, or a channel between threads using librabbitmq."
Maybe there is some way to create two instances of amqp_connection_state_t, one for consumption and another one for acknowledging?