我有一个与以下代码连接的公司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) {}
}
}
}
Where to change prefetch value in activemqhttp://activemq.apache.org/what-is-the-prefetch-limit-for.html
为我添加此修复程序?consumer.prefetchSize = 1