Activemq 接受消息慢

yuyezitong 2014-01-09 05:18:27
问题描述:发送十万条消息对activemq队列中,其中每个五百条发送一条带有selector消息。创建一个同样selector的消费者,发现接受消息很慢。具体代码如下:
 for (int i = 0; i < 50000; i++)
{
ITextMessage message;

if (i % 1000 == 0)
{
message = session.CreateTextMessage(msg);
message.Properties.SetString("JMXGroupID ", "A");
}
else
{
message = session.CreateTextMessage(msg);
}
producer.Send(message, MsgDeliveryMode.Persistent, MsgPriority.Normal, TimeSpan.MinValue);
}

接受核心代码:
 IDestination destination = SessionUtil.GetDestination(session, "testing");
IMessageConsumer consumer = session.CreateConsumer(destination, "JMXGroupID = 'A'", false);
for (int i = 0; i < 50; i++)
{
IMessage iMsg = consumer.Receive();
ITextMessage msg = (ITextMessage)iMsg;
Console.WriteLine(msg.Text);
count++;

}



...全文
5356 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
全栈极简 2014-01-11
  • 打赏
  • 举报
回复
那你没隔100条试试看。

8,833

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 组件/控件开发
社区管理员
  • 组件/控件开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧