You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Stephen <re...@inode.serveftp.com> on 2009/02/16 11:19:23 UTC

C++ broker - Java Client with AutoAcknowledge

Hi all

I suspect C++ broker does not receive the auto acknowledge message from Java.

I have a run a program like following:

Start C++ broker, with default settings
Start a Java consumer and listen to the C++ broker
The consumer session is AUTO_ACKNOWLEDGE mode
Start a Java producer and send a text message to c++ broker
Java consumer received the message normally
Java consumer exit
Java producer exit
Start Java consumer again
Now the consumer received the previous message
If consumer is set to NO_ACKNOWLEDGE mode, it wont receive previous message
It seems that C++ broker does not receive the auto acknowledge message from Java,

Any Idea?

Regards,
Stephen

-----------------------part of consumer codes
   Destination d = AMQDestination.createDestination(new AMQBindingURL("direct://dev//queue"));
   AMQConnectionFactory acf = new AMQConnectionFactory("amqp://user:pass@client/development?brokerlist='tcp://host:5672'");
   Connection c = acf.createConnection();
   consumerSession = c.createSession(false, AMQSession.AUTO_ACKNOWLEDGE);
   MessageConsumer messageConsumer = consumerSession.createConsumer(d);
   c.start();
----------------------part of producer codes
   Destination d = AMQDestination.createDestination(new AMQBindingURL("direct://dev//queue"));
   AMQConnectionFactory acf = new AMQConnectionFactory("amqp://user:pass@clientid/development?brokerlist='tcp://host:5672'");
   Connection c = acf.createConnection();
   AMQSession s = (AMQSession) c.createSession(false, AMQSession.NO_ACKNOWLEDGE);
   MessageProducer p = s.createProducer(d, false, true);
   TextMessage tm = s.createTextMessage("happy 2009!!!!");
   p.send(tm, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY,
     Message.DEFAULT_TIME_TO_LIVE);
------------------

Re: C++ broker - Java Client with AutoAcknowledge

Posted by Andrew Wright <at...@mac.com>.
Hi Stephen,

This is a problem in the java client that shipped with M4. It's fixed  
in svn-trunk, if you need a workaround in the meantime, you can add  
maxprefetch='1' to the broker connection string.

Cheers,
Andrew

On 16 Feb 2009, at 10:19, Stephen wrote:

> Hi all
>
> I suspect C++ broker does not receive the auto acknowledge message  
> from Java.
>
> I have a run a program like following:
>
> Start C++ broker, with default settings
> Start a Java consumer and listen to the C++ broker
> The consumer session is AUTO_ACKNOWLEDGE mode
> Start a Java producer and send a text message to c++ broker
> Java consumer received the message normally
> Java consumer exit
> Java producer exit
> Start Java consumer again
> Now the consumer received the previous message
> If consumer is set to NO_ACKNOWLEDGE mode, it wont receive previous  
> message
> It seems that C++ broker does not receive the auto acknowledge  
> message from Java,
>
> Any Idea?
>
> Regards,
> Stephen
>
> -----------------------part of consumer codes
>   Destination d = AMQDestination.createDestination(new  
> AMQBindingURL("direct://dev//queue"));
>   AMQConnectionFactory acf = new AMQConnectionFactory("amqp:// 
> user:pass@client/development?brokerlist='tcp://host:5672'");
>   Connection c = acf.createConnection();
>   consumerSession = c.createSession(false,  
> AMQSession.AUTO_ACKNOWLEDGE);
>   MessageConsumer messageConsumer = consumerSession.createConsumer(d);
>   c.start();
> ----------------------part of producer codes
>   Destination d = AMQDestination.createDestination(new  
> AMQBindingURL("direct://dev//queue"));
>   AMQConnectionFactory acf = new AMQConnectionFactory("amqp:// 
> user:pass@clientid/development?brokerlist='tcp://host:5672'");
>   Connection c = acf.createConnection();
>   AMQSession s = (AMQSession) c.createSession(false,  
> AMQSession.NO_ACKNOWLEDGE);
>   MessageProducer p = s.createProducer(d, false, true);
>   TextMessage tm = s.createTextMessage("happy 2009!!!!");
>   p.send(tm, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY,
>     Message.DEFAULT_TIME_TO_LIVE);
> ------------------


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