Open moinologics opened 1 year ago
i have tried this example as it's working as expected. but i want to use something like this in flutter.
i have a function in main.dart file in flutter app, thats runs on a button click
Future<void> consumeQueue() async {
final amqpClient = amqp.Client(settings: connectionSettings); //
final channel = await amqpClient.channel();
final queue = await channel.queue(settings['amqp_queue']);
amqpConsumer = await queue.consume(); // amqpConsumer is global var as need to call cancel() method from somewhere else
final subscription = amqpConsumer?.listen(handleIncomingSMSRequest);
}
i want to keep consumer listen in background, but consumer is consuming messages one time and after not receiving any message.
i want to perform a simple task
run consumer in background for a queue, and pick 5 messages at a time and perform operation on each. how to achieve this?