On 06/07/2011 05:14 AM, [email protected] wrote:
Hi dear qpid-users,
i'm new to qpid and tried to access qpid over c#. I copied the c# sample
from the qpid-doc and tried to send over 1000 messages - after 500 messages
i always get a "Client max connection count limit exceeded: 500 connection
refused".
I'm using qpid 0.10 32bit in c# 3.5. Can anybody help me - where is the
mistake?
2 points:
Set --max-connections on the broker to something large if you really want large
numbers of connections BUT
Your code is creating a brand new connection for every message. I suspect you
really want to create the sender before the loop and send all your messages
using the same sender. Setting up and tearing down a connection for every
message is going to be very slow.
Cheers,
Alan.
Here is my sample code
(from
http://qpid.apache.org/books/0.8/Programming-In-Apache-Qpid/pdf/Programming-In-Apache-Qpid.pdf
- example 2.3 on page 5)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Org.Apache.Qpid.Messaging;
namespace Qpid500Test
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i< 1000; i++)
{
String broker = args.Length> 0 ? args[0] : "localhost:5672";
String address = args.Length> 1 ? args[1] : "amq.topic";
Connection connection = null;
try
{
connection = new Connection(broker);
connection.Open();
Session session = connection.CreateSession();
Receiver receiver = session.CreateReceiver(address);
Sender sender = session.CreateSender(address);
sender.Send(new Message("Hello world!"));
Message message = new Message();
message = receiver.Fetch(DurationConstants.SECOND * 1);
Console.WriteLine("{0}", message.GetContent());
session.Acknowledge();
connection.Close();
}
catch (Exception e)
{
Console.WriteLine("Exception {0}.", e);
if (null != connection) connection.Close();
}
}
}
}
Thanks in advance,
Yours
Joe
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]