FWIW have you tried the latest code in SVN as we've applied a few
patches to the C# code recently.
Incidentally in JMS you are only meant to use a synchronous consumer
or an asynchornous consumer and not mix them. (e.g. its an error and
you get an exception if you try set a listener on a synchronous
consumer - it might be worth doing the same in C#)
Have you tried using just one or the other?
On 7/28/06, Matthew Xie <[EMAIL PROTECTED]> wrote:
I am using asynchronous approach to consume message by amq dotnet api.
the problem is that if i send serval messages to the amq server then i start
asynchronous approach consumer code to listen the message, but unexpectly i
found that nothing recieve. but if i send a message again then all the
messages are recieved include the lastest message.
here's the my test code:
public void recieve(String queueName)
{
using (IConnection connection = factory.CreateConnection())
{
AcknowledgementMode acknowledgementMode =
AcknowledgementMode.ClientAcknowledge;
ISession session =
connection.CreateSession(acknowledgementMode);
IDestination destination = session.GetQueue(queueName);
// lets create a consumer and producer
IMessageConsumer consumer =
session.CreateConsumer(destination);
//recieve the old message
// IMessage message =
consumer.Receive(TimeSpan.FromMilliseconds(200));
received = false;
consumer.Listener += new MessageListener(OnMessage);
Console.WriteLine("Start to listen messengers(program will
be exited upon received messenger)");
WaitForMessageToArrive();
}
}
protected void OnMessage(IMessage message)
{
ActiveMQTextMessage textmessage = (ActiveMQTextMessage)message;
Console.WriteLine("Received message with ID: {0}",
textmessage.NMSMessageId);
String text = HttpUtility.UrlDecode(textmessage.Text);
Console.WriteLine("Received message with text: " + text);
message.Acknowledge();
lock (semaphore)
{
received = true;
Monitor.PulseAll(semaphore);
}
}
is there anything incrroect?
could someone do me a favor?
thanks!
matt
--
View this message in context:
http://www.nabble.com/problem-with-openwire-dotnet-tf2013952.html#a5534983
Sent from the ActiveMQ - User forum at Nabble.com.
--
James
-------
http://radio.weblogs.com/0112098/