qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nekresh <nekr...@gmail.com>
Subject C# client on qpid 0.6
Date Tue, 10 Aug 2010 22:24:03 GMT
Hello everyone.

I'm currently testing qpid 0.6 and have a few problems.

I've first tried the Messaging API.
On the C++ 0.6 broker, it simply doesn't work. Well, it's in the
documentation (http://qpid.apache.org/compatibility.html) so I won't
try more that way.
I then tried the Java 0.6 broker but wasn't able to receive message at
all. Even in debug trace, the message are received by the broker and
forwarded to the right queue but I never receive them.
Am I missing something ?
I'm creating the queue, binding it to the exchange amq.direct with the
correct routing_key.

static void Main(string[] args)
{
   Console.WriteLine("Init");

   var info = new QpidConnectionInfo();
   info.AddBrokerInfo(new AmqBrokerInfo("tcp", "localhost", 5672, false));
   info.Username = "guest";
   info.Password = "guest";

   using (var connection = new AMQConnection(info))
   {
       using (var ch = connection.CreateChannel(false,
Apache.Qpid.Messaging.AcknowledgeMode.PreAcknowledge))
       {
           ch.DeclareQueue("message_queue", true, false, false);
           ch.Bind("message_queue", "amq.direct", "test");

           var builder = ch.CreateConsumerBuilder("message_queue");
           using (var consumer = builder.Create())
           {
               Console.WriteLine("Ready");

               while (true)
               {
                   var message = consumer.Receive();
                   //var message = consumer.Receive(10000);
                   if (message != null)
                   {
                       Console.WriteLine("message received");
                   }
               }
           }
       }
   }
}

Then I tried the 0-10 API on the Java broker, but have strange behavior.
I can send and receive messages, but the messages are kept in the
queue. I receive the message only once but, when I restart my
consumer, then message are sent back to me.
As they aren't removed from the queue, I guess the queue will become
filled up very fast and stop working.

static void Main(string[] args)
{
   Console.WriteLine("Init");

   var client = new Client();
   client.Connect("localhost", 5672, "", "guest", "guest");
   var ch = client.CreateSession(10000);

   ch.QueueDeclare("message_queue", Option.DURABLE);
   ch.ExchangeBind("message_queue", "amq.direct", "test");

   ch.AttachMessageListener(new Listener(), "message_queue");
   ch.MessageSubscribe("message_queue");

   Console.WriteLine("Press enter to exit");
   Console.ReadLine();
   Console.WriteLine("Stopping");
   ch.Close();
   client.Close();
}

With a class Listener displaying the message received.
I haven't found a way to acknoledge received message in the 0-10 API,
only the listener way.
How is it possible to ack received message ?

In the list archive, I've found a message regarding which API
implementation to choose and the Messaging one was preferred. Do you
think it still applies now ?

Thanks for reading my (too) long message.

Nekresh

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Mime
View raw message