[
https://issues.apache.org/activemq/browse/AMQCPP-188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44172#action_44172
]
Nathan Mittler commented on AMQCPP-188:
---------------------------------------
I've applied the change to trunk - many thanks!
My guess as to why this was missing is simply because we weren't fully
considering the use case...
The JMS spec (CMS is just a port of JMS to C++), indicates that a session and
all resources from that session are to be used from a single thread context.
This would mean that in the pure JMS case, it wouldn't be recommended to
close() a consumer from a different thread than you're synchronous consumer
(receive()).
ActiveMQ-CPP tends to be a bit more liberal with how the consumers can be used,
however, and what you were trying to do should work - but apparently there were
some bits missing.
I'll close this issue after I've done some testing.
> ActiveMQ message consumer waiting for receive to complete is not closing...
> ---------------------------------------------------------------------------
>
> Key: AMQCPP-188
> URL: https://issues.apache.org/activemq/browse/AMQCPP-188
> Project: ActiveMQ C++ Client
> Issue Type: Bug
> Components: CMS Impl
> Affects Versions: 2.2
> Environment: Windows
> Reporter: Rakesh
> Assignee: Nathan Mittler
> Fix For: 2.2.1
>
>
> I have a created an application which creates a connection and consumers
> using ActiveMQ C++ Client, after running the application consumer is waiting
> for the recive to complete. when we shutdown the application we close the
> connection, but close call of connection does not notify all the consumers
> (who is waiting for the message to be recived).
> I have seen in the close method of ActiveMQConsumer after purging all the
> messages there is no call to notifyAll on object unconsumedMessages because
> of which consumers waiting for the receive does not does not come out of the
> wait call, which is causing our application not to shutdown.
> we modified the close call the notify all the consumers after purging all the
> unconsumed mesages and our application is working fine.
> Following is the changes that i have made in ActiveMQConsumer.cpp class
> void ActiveMQConsumer::close(){
> ....
> ....
> // Purge all the pending messages
> try{
> purgeMessages();
> } catch ( ActiveMQException& ex ){
> if( !haveException ){
> ex.setMark( __FILE__, __LINE__ );
> error = ex;
> haveException = true;
> }
> }
> //Start of additional code
> synchronized( &unconsumedMessages )
> {
> unconsumedMessages.notifyAll();
> }
> //End of additional code
> ....
> ....
> }
> can anyone let me know why this has not been done? I think this should be
> done. please explain if I am missing something
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.