这个问题涉及使用AMQP在 .Net 环境下消费消息。官方文档推荐使用 amqpnetlite:https://access.redhat.com/documentation/en-us/red_hat_amq/7.0/html-single/using_the_amq_.net_client/index。
在使用 AMQPNetLite 订阅地址时,地址和队列将被自动创建。但是,自动创建的队列始终是“单播”的。我无法自动创建以下内容:
也许我漏了一些标志?
- 可允许任意数量消费者的多播队列。
private async Task RenewSession()
{
Connect = await Connection.Factory.CreateAsync(new Address("amqp://admin:admin@localhost:5672"), new Open() {ContainerId = "client-1"});
MqSession = new Session(Connect);
var receiver = new ReceiverLink(MqSession, DEFAULT_SUBSCRIPTION_NAME, GetSource("test-topic"), null);
receiver.Start(100, OnMessage);
}
private Source GetSource(string address)
{
var source = new Source
{
Address = address,
ExpiryPolicy = new Symbol("never"),
Durable = 2,
DefaultOutcome = new Modified
{
DeliveryFailed = true,
UndeliverableHere = false
}
};
return source;
}
也许我漏了一些标志?