You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just did a quick test with this package (version 0.0.1) and the following code. After the first message (or bunch of messages) no more messages are received and the rabbitmq queue grows up.
import"package:dart_amqp/dart_amqp.dart";
main() async {
// auto-connect to localhost:5672 using guest credentialsClient client =newClient();
final channel =await client.channel();
final queue =await channel.queue("test", durable:true);
final consumer =await queue.consume();
consumer.listen((message) {
// Get the payload as a stringprint(" [x] Received string: ${message.payloadAsString}");
// Or unserialize to jsonprint(" [x] Received json: ${message.payloadAsJson}");
// Or just get the raw data as a Uint8Listprint(" [x] Received raw: ${message.payload}");
message.ack();
});
}
The text was updated successfully, but these errors were encountered:
The problem seems to be caused by the message.ack() statement. The default parameters for queue.consume specify the noAck: true flag. Rabbitmq is not expecting an ACK for messages so it sends back an error (you can receive that by adding the onError handler to consumer.listen)
To resolve the problem either remove message.ack() or change the final consumer = await queue.consume(); to final consumer = await queue.consume(noAck: false); if you need to ack messages.
I just did a quick test with this package (version 0.0.1) and the following code. After the first message (or bunch of messages) no more messages are received and the rabbitmq queue grows up.
The text was updated successfully, but these errors were encountered: