achilleasa / dart_amqp

Dart AMQP client implementing protocol version 0.9.1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to call a asynchronous function inside a consumer.listen()

lkrjangid1 opened this issue · comments

IIUC the recommended way to invoke async functions within a sync block is to use await.

Wouldn't something like this work for you?

consumer.listen((message) {
  await doSomethingWith(message);
  message.ack();
});