Hello,

Using Qpid JMS 0.11.0 AMQP 1.0 client, which is the latest version for Java 7, we experienced an issue when you set prefetch > 1 and start consuming messages from a queue in asynchronous mode, using "onMessage()" method and sessionMode = Session.CLIENT_ACKNOWLEDGE.

Taking prefetch= 10 as example, I noticed that:

  1. When you open connection/session/listener, the client sends a "flow" performative with linkCredit=10, which is correctly the prefetch value. Prefetched messages = 10
  2. The client starts to process the first message received using class "MessageDeliverTask" method "run()" (all inside JmsMessageConsumer.java)
  3. There is a call "ackFromReceive(envelope)" at row 667 which, following sub-calls, will call method "sendFlowIfNeeded()" of class "AmqpConsumer"
  4. in this method "newCredit" is calculated to send a new "flow" performative. Here the calculation doesn't check how many prefetched messages already are on client side. The currentCredit is 0, for this reason is sent a "flow" performative with linkCredit=10. Prefetched messages =20
  5. There is a call "messageListener.onMessage(copy);" at row 672 which triggers the import of the message. Then the prefetched messages = 19.
  6. The process starts again from point 2 increasing constantly the prefetched messages collected on client side, causing timeout issues because if they are 1 million of messages, the client can't process them before they expire

I compared code of method "sendFlowIfNeeded()" (see point 3) in version 0.11.0 with the code of version 0.31.0: in version 0.31.0 the code is changed and the calculation considers also "prefetchMessageCount".

Is this a known issue? Will you fix it for 0.11.x version because it is the latest version for Java 7?

Best Regards

--
SMC
                  Consulting

facebook  linkeding
Alessandro Crotti
Senior Developer

tel:  +39 342 573 4450
skype:  crotti.alessandro

SMC Consulting
Via dell'industria, 87 41012 Carpi (MO) - Italy
tel: +39 059 664875

CONFIDENTIALITY NOTICE: This message may contain confidential and/or privileged information.
If you are not the intended recipient, please do not use its contents for any purpose, advise
the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.