Hi Gordon, I tried the suggestion you had. I found that the scenario still exists and messages are repeated when the broker killed and restarted. I tried 2 things. I have a loop that sends 20 messages and then after I have the session.sync() call. In this case the messages that are repeated are the same as the setCapacity() call I had made when the sender is created. If I perform the sync call every after every send(), then the number of messages are reduced to 2 on a restart of the broker.
Of course if I set the link option to be unreliable when I create a sender, the messages do not get repeated. I would like figure out why this happens and maybe it is an education on my part. Thanks Nitin -----Original Message----- From: Gordon Sim [mailto:[email protected]] Sent: Thursday, August 16, 2012 10:05 AM To: [email protected] Subject: Re: Can someone help to understand On 08/15/2012 10:14 PM, Nitin Shah wrote: > Hi, > > I wanted to run this by the developers to understand why this happens. > We are running the release 0.16 C++ broker and have written some > applications to use the infrastructure. I have developed a simple > applications that sends messages to a receiving application on from > the amq.topic exchange using the auto created queues. The connection > is setup to reconnect in the broker goes down by setting connection > option as reconnect:true. > > I am using the receive loop for the messages s getNextReceiver calls. > In order for that to work the setCapacity for receivers is set at 10 > for that matter could be higher. The applications are linked with the > qpidclient library -background info. The senderstarts up and sends 20 > messages which the receiver receives. After that the sender does not > send any more messages. The test that I was trying was , what happens > if the broker is killed and then restarted. What I see if I do that is > that all the messages are resent by the broker to the receiving loop. > > I haven't done anything to the link options so they must be the > default ones. Each message received is acked with the session > acknowledge calls, so I assume the buffers must be released and the > messages not kept in the qpid subsystem. However that does not seem to > be the case and each time I restart the qpidd deaemon, the messages > are resent to the receiving app. I have played around with setting > capacity in the sender and the receiver. If I set the capacity of the > sender to 1 then only one message is retransmitted when the broker > comes up. If I set the capacity on the sender and the receiver to 100 > i.e. higher than 20 then all messages get resent on every restart of the > broker. It is in fact the sender that is resending the messages. The sender maintains a buffer of messages it has sent until the broker confirms them. On failover it will resend these 'in-doubt' messages. The capacity dictates the frequency at which the sender requests confirmation from the broker. You can also call Session::sync() on the senders session at any time to request the broker to indicate when it has received all the outstanding messages. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
