You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by SteveDicks <st...@mygameskills.com> on 2007/10/11 11:48:00 UTC

ActiveMQ C++ (CMS) problems

Hi,
  I'm using CMS 2.1 with ActiveMQ 4.1 in transactional mode, and using
callbacks (onMessage) to alert me to a message arriving. However I have 2
problems:

a) If I call Session::commit() in onMessage() (which none of the examples
do) then I get a core dump.
b) Having worked around (a), calling Session::rollback() appears to have no
effect - I have to close and re-open the session to get the desired effect
of the message being put back into the MQ to be retrieved again.
-- 
View this message in context: http://www.nabble.com/ActiveMQ-C%2B%2B-%28CMS%29-problems-tf4606106s2354.html#a13152461
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ActiveMQ C++ (CMS) problems

Posted by SteveDicks <st...@mygameskills.com>.


Albert Strasheim wrote:
> 
> Hello,
> 
> If you could provide us with a basic sample of the code that exhibits the 
> problems you're seeing, that would be very helpful.
> 
>>
>> Hi,
>>  I'm using CMS 2.1 with ActiveMQ 4.1 in transactional mode, and using
>> callbacks (onMessage) to alert me to a message arriving. However I have 2
>> problems:
>>
>> a) If I call Session::commit() in onMessage() (which none of the examples
>> do) then I get a core dump.
> 
> Basically I have the example code for the consumer modified so that:
> 
> session = connection->createSession( Session::SESSION_TRANSACTED );
> 
> and:
> 
> void MQConsumer::onMessage(const Message* message)
> {  
>    static int count = 0;
> 
>    count++;
>    const TextMessage* textMessage = dynamic_cast< const TextMessage* >(
> message );
> 
>    if( textMessage != 0 ) 
>    {
>       const std::string text = textMessage->getText();
>       session->commit();
>    }
>    else
>    {
>       throw std::runtime_error("Received something other than a text
> message");
>    }
> }
> 
>> b) Having worked around (a), calling Session::rollback() appears to have 
>> no effect - I have to close and re-open the session to get the desired
>> effect
>> of the message being put back into the MQ to be retrieved again.
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-C%2B%2B-%28CMS%29-problems-tf4606106s2354.html#a13164264
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ActiveMQ C++ (CMS) problems

Posted by Albert Strasheim <fu...@gmail.com>.
Hello,

If you could provide us with a basic sample of the code that exhibits the 
problems you're seeing, that would be very helpful.

Even better, you might consider creating a AMQCPP JIRA issue, and attaching 
the code there.

Regards,

Albert

----- Original Message ----- 
From: "SteveDicks" <st...@mygameskills.com>
To: <us...@activemq.apache.org>
Sent: Thursday, October 11, 2007 11:48 AM
Subject: ActiveMQ C++ (CMS) problems


>
> Hi,
>  I'm using CMS 2.1 with ActiveMQ 4.1 in transactional mode, and using
> callbacks (onMessage) to alert me to a message arriving. However I have 2
> problems:
>
> a) If I call Session::commit() in onMessage() (which none of the examples
> do) then I get a core dump.
> b) Having worked around (a), calling Session::rollback() appears to have 
> no
> effect - I have to close and re-open the session to get the desired effect
> of the message being put back into the MQ to be retrieved again.