gpt4 book ai didi

rabbitmq - Dart 和 RabbitMQ 绑定(bind)交换

转载 作者:行者123 更新时间:2023-12-03 03:02:08 26 4
gpt4 key购买 nike

我使用 STOMP package ,我写了一个测试:

test('can subscribe and send events to mq server', () async {
StompClient client2 = await serverClient.connect(mqIp,
port: mqPort, login: login, passcode: password);

client2.sendJson('Domain changed', {'a':'b'});
client2.disconnect();

StreamController controller = new StreamController();
Stream<String> stream = controller.stream.asBroadcastStream();

StompClient client1 = await serverClient.connect(mqIp,
port: mqPort, login: login, passcode: password);

client1.subscribeString("Entity changed", 'Domain changed',
(Map<String, String> headers, String message) {
controller.add(message);
}, ack: AUTO);

await for (String message in stream) {
String expectedEntity =
'{\"a\":\"b\"}';
expect(message, equals(expectedEntity));
break;
}

client1.unsubscribe("Entity changed");
client1.disconnect();
}, timeout: new Timeout(new Duration(seconds: 6)));

当我运行 pub run test我得到 Test timed out .

在绑定(bind)部分的 RabbitMQ 管理中,我得到: (Default exchange binding)消息总数为零:

enter image description here

是否可以在一个 channel 中发送和接收消息?

如果我使用 client1.subscribeString(ack: CLIENT,...)在 RabbitMQ 管理中,我收到一条消息“内存中”,但仍然测试 Test timed out而且我无法从 mq 收到消息。
enter image description here

也许我必须设置 amq.fanout 交换,但我该怎么做呢?

最佳答案

将 RabbitMq 与 dart 一起使用的最佳选择:mqtt package

关于rabbitmq - Dart 和 RabbitMQ 绑定(bind)交换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45305362/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com