Closed rudrasur closed 3 years ago
I am looking for help in keeping the consumer alive and listen messages continuously
You probably want to use a loop:
while (TRUE) {
amqp_listen(...)
}
How to read message text (body)
The message has a body
element accessible as, e.g. msg$body
. Since messages can contain non-text content, the body is a raw
vector; you can convert it to a string with rawToChar()
.
Great, thank you for response.
@atheriel As suggested for keeping the consumer alive and listening to messages continuously
while (TRUE) {
amqp_listen(conn, timeout = 900)
}
So if I try to connect to an empty queue I am getting the following error immediately
<simpleError in amqp_listen(conn, timeout = 900): Disconnected from server.>
If connect to a non-empty queue, my message processing start but as soon the queue becomes empty I see the same error as above. Now if new messages are added to the queue those are not processed and I keep seeing the same error as above
<simpleError in amqp_listen(conn, timeout = 900): Disconnected from server.>
<simpleError in amqp_listen(conn, timeout = 900): Disconnected from server.>
<simpleError in amqp_listen(conn, timeout = 900): Disconnected from server.>
<simpleError in amqp_listen(conn, timeout = 900): Disconnected from server.>
I also saw that in RabbitMQ Admin UI that once the above error start coming connection count keeps on increasing
@bhrigushr I think you may need to provide a more reproducible example, your description of the problem isn't really enough to go on right now.
Thanks, figured out what I was doing wrong.
Hi, I am looking for help in keeping the consumer alive and listen messages continuously, is there any such feature available using this library ?
Another question: How to read message text (body) from
amqp_message
objectThanks, Surendhar