Iam using ActiveMQ 4.1.1 and ActiveMQ-cpp-2.1.3  on Windows 2003 server
Enterprise Edition with VC++ 8.0.
      
      Iam sending persistent text messsage using Topic to a destination.
(wireFormat=openwire, transport.useAsyncSend=false, 
Session::AUTO_ACKNOWLEDGE, DeliveryMode::PERSISTENT ).

What my requirement is to generate a message by monitoring Windows. And send
the generated message to ActiveMQ on central server. And keep on monitoring
Windows.
I am using the following code to connect to activemq.  

               // Create a ConnectionFactory
                ConnectionFactory* connectionFactory =
                        ConnectionFactory::createCMSConnectionFactory( 
brokerURI );

                // Create a Connection
                connection = connectionFactory->createConnection();
                connection->start();

                // free the factory, we are done with it.
                delete connectionFactory;

                // Create a Session
                session = connection->createSession( Session::AUTO_ACKNOWLEDGE 
);

                // Create the destination (Topic or Queue)
                if( useTopic ) {
                        destination = session->createTopic( subject );
                } else {
                        destination = session->createQueue( subject );
                }

                // Create a MessageProducer from the Session to the Topic or 
Queue
                producer = session->createProducer(destination );
                if(persistent)
                        producer->setDeliveryMode( DeliveryMode::PERSISTENT );
                else
                        producer->setDeliveryMode(DeliveryMode::NON_PERSISTENT);

                if(timeToLive)
                producer->setTimeToLive(timeToLive);

Then after generating every message, i am instantly sending it to activemq
using following code

                // Create a message
                TextMessage* message = session->createTextMessage( sendmessage 
);
                message->setIntProperty( "Integer", 0 );

                // Tell the producer to send the message
                producer->send( message );

                //indicate message sent
                msgdelivered = true;

                delete message;

I am able to send aroung 20000 messages succcessfully. But after that it is
giving the following exception at a call to send() of producer.
       
      "Unhandeled exception at 0x7c82823e in myaplication.exe:
0xC0000005:Access violation writing location 0x00040ffc."
      
      And my application is stopping the execution in free.c at "retval =
HeapFree(_crtheap, 0, pBlock);".

      When i run Stackwalker (from CodeProject, Project:
Memory_and_Exception_Trace, Author: Jochen Kalmbach) for this application it
is showing stack over flow in ActivemqCpp.  

Thanks,
narts

-- 
View this message in context: 
http://www.nabble.com/Unhandeled-exception-when-producer-sending-message-in-free.c-at-HeapFree-after-sending-large-ammount-of-messages-tp16349020s2354p16444324.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to