ActiveMQ:多个消费者,但只有1个收到消息

问题描述 投票:0回答:1

我有一个与以下代码连接的公司ActiveMQ。一切看起来正确,代码完美地处理了消息。管理员对不同的使用者名称感到满意(每个部署都有一个不同的名称),并且可以在其ActiveMQ网页上看到它。我的问题是此代码已安装在多台服务器上,并且都需要同时使用同一条消息,但是只有1个应用程序可以接收该消息。我想念什么?感谢您的帮助!

IConnectionFactory activeMQConnection = new ConnectionFactory(Url, "distinctConsumerName");

            using (IConnection connection = activeMQConnection.CreateConnection(UserName, Password))
            {
                connection.Start();
                using (ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge))
                {
                    using (var dest = session.GetTopic("theSchema"))
                    using (IMessageConsumer consumer = session.CreateDurableConsumer(dest, "distinctConsumerName", null, true))
                    {
                        while ((msg = consumer.Receive()) != null) {}
                    }
                }
            }
.net activemq
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.