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.

Reply via email to