[ 
https://issues.apache.org/jira/browse/QPIDJMS-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15832453#comment-15832453
 ] 

ASF subversion and git services commented on QPIDJMS-244:
---------------------------------------------------------

Commit 6d1adfd227dcbe3993cdc753ed202c53ac2a2f77 in qpid-jms's branch 
refs/heads/master from [~tabish121]
[ https://git-wip-us.apache.org/repos/asf?p=qpid-jms.git;h=6d1adfd ]

QPIDJMS-244 Ensure async delivery allows acks before close

Ensure that the async message delivery is waited on when closing to
ensure that in auto ack mode the client acks the processed message
before the connection is closed.  

> Connection close does not wait for acknowledgement of in-flight message 
> delivery with asyncronous auto-ack MessageConsumer
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: QPIDJMS-244
>                 URL: https://issues.apache.org/jira/browse/QPIDJMS-244
>             Project: Qpid JMS
>          Issue Type: Improvement
>          Components: qpid-jms-client
>    Affects Versions: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0, 
> 0.9.0, 0.10.0, 0.11.0, 0.11.1, 0.20.0
>            Reporter: Alex Rudyy
>             Fix For: 0.21.0
>
>
> The jms client can fail to acknowledge the message  (with auto-ack delivery 
> mode) which is in a process of delivery with MessageListener when 
> Connection#close() is called from main application thread.
> The exception like the one below is delivered into ExceptionListener:
> Connection ExceptionListener fired, exiting.
> {noformat}
> javax.jms.IllegalStateException: The MessageConsumer is closed
>     at 
> org.apache.qpid.jms.JmsMessageConsumer.checkClosed(JmsMessageConsumer.java:328)
>     at 
> org.apache.qpid.jms.JmsMessageConsumer.doAckConsumed(JmsMessageConsumer.java:372)
>     at 
> org.apache.qpid.jms.JmsMessageConsumer.access$600(JmsMessageConsumer.java:52)
>     at 
> org.apache.qpid.jms.JmsMessageConsumer$MessageDeliverTask.run(JmsMessageConsumer.java:679)
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>     at java.lang.Thread.run(Thread.java:745){noformat}
> Such behavior could be considered JMS spec compliment, as the JMS 
> specification v1.1 states in "4.3.5 Closing a Connection" :
> {quote}
> If one or more of the connection’s session’s message listeners is processing 
> a message at the point when connection close is invoked, all the facilities 
> of the connection and its sessions must remain available to those listeners 
> until they return control to the JMS provider."
> {quote}
> Thus, it seems that closing of the connection is allowed without sending the 
> acknowledgment (and waiting for response), as acknowledgment is sent after 
> the control is returned to JMS provider.
> However, from practical point of view, such behavior might not be desirable, 
> as it would cause duplicate message deliveries for those messages not being 
> acknowledged on close. I would expect from the JMS client to acknowledge the 
> in-flight auto-ack message deliveries with MessageConsume#onMessage before 
> the connection close.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to