achilleasa / dart_amqp

Dart AMQP client implementing protocol version 0.9.1
MIT License
79 stars 40 forks source link

Help #40

Closed duhualong closed 4 years ago

duhualong commented 4 years ago

Code: ConnectionSettings settings = new ConnectionSettings( host: "192.168.50.83", port: 5672, virtualHost: '/', authProvider: new PlainAuthenticator("arx7", "arbalest")); Client client = new Client(settings: settings);

Channel channel = await client.channel();
Exchange exchange =
await channel.exchange("luwak_topic", ExchangeType.TOPIC);
Consumer consumer = await exchange.bindPrivateQueueConsumer(['#']);

    consumer.listen((message) {
  print(
      "[Exchange: ${message.exchangeName}] [${message.routingKey}] ${message.payloadAsString}");
});

Question:

achilleasa commented 4 years ago

Looks like you are using a pre-existing exchange that was created with a durable flag and amqp expects that producers and consumers define shared resources using exactly the same flags. I believe that you can get it working by changing:

await channel.exchange("luwak_topic", ExchangeType.TOPIC);

to:

await channel.exchange("luwak_topic", ExchangeType.TOPIC, durable: true);