The scenario:I send fifty thousand messages to the queue named JUST.CN. And seting one message propertyString "myfilter='abc'" every 1000 message.Now I create consumer with the same selctor to consume messages.However the comsuming rate is very slow especialy after 30000 messages.I cant change default configuration in activeMQ. The Core Code is below:
IDestination destination = SessionUtil.GetDestination(session, "JUST.CN");
IMessageProducer producer = session.CreateProducer(destination);
string msg = "Hello hello hello world!~~testing~Hello hello hello world!~~testing~";
for (int i = 0; i < 50000; i++)
{
ITextMessage message;
if (i % 1000 == 0)
{
message = session.CreateTextMessage(msg);
message.Properties.SetString("myfilter", "abc");
}
else
{
message = session.CreateTextMessage(msg);
}
producer.Send(message, MsgDeliveryMode.Persistent, MsgPriority.Normal, TimeSpan.MinValue);
}
The Consumer's code:
IDestination destination = SessionUtil.GetDestination(session, "JUST.CN");
IMessageConsumer consumer = session.CreateConsumer(destination, "myfilter='abc'", false);
int count = 0;
DateTime dtstart = DateTime.Now;
for (int i = 0; i < 50; i++)
{
IMessage iMsg = consumer.Receive();
ITextMessage msg = (ITextMessage)iMsg;
Console.WriteLine(msg.Text);
count++;
}
DateTime dtend = DateTime.Now;
TimeSpan time = dtend - dtstart;
Console.WriteLine(time);
Console.WriteLine(count);
Is there any special setting that I need to use for the selectors to ActiveMQ? Thank you in advance for any inputs.