You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by dongabda <do...@ikusi.es> on 2009/04/06 10:34:13 UTC

Re: Reconnection

Here is the code, I think can be useful to know the problem.
Thanks for your help.

virtual void run(){
      try {
            // Create a ConnectionFactory
	string brokerURI =
tcp://192.168.233.214:61616?&soLinger=10000&soKeepAlive=true		
            auto_ptr<ConnectionFactory> connectionFactory(
                ConnectionFactory::createCMSConnectionFactory( brokerURI )
);
            // Create a Connection
            connection = connectionFactory->createConnection("","","Test1");
            connection->start();
            connection->setExceptionListener(this);
            // Create a Session
            if( this->sessionTransacted == true ) {
                session = connection->createSession(
Session::SESSION_TRANSACTED );
            } else {
                session = connection->createSession(
Session::AUTO_ACKNOWLEDGE );
            }
                queue = session->createQueue( "Monitor" );
           
            // Create a MessageConsumer from the Session to the Topic or
Queue
            consumer = session->createConsumer( queue, "id='192.168.240.23'"
);

            consumer->setMessageListener( this );
            std::cout.flush();
            std::cerr.flush();

            // Indicate we are ready for messages.
            latch.countDown();

            // Wait while asynchronous messages come in.
			doneLatch.await( waitMillis );
			


        } catch( CMSException& e ) {
            // Indicate we are ready for messages.

            latch.countDown();
		
			bConnected = false;
            e.printStackTrace();
        }catch(Exception& ex){
		}
    }


Andreas Gies-3 wrote:
> 
> Hi,
> 
> perhaps you could come up with a small test case that shows the error ?
> 
> Best regards
> Andreas
> 
> 
> On Mar 26, 2009, at 10:11 AM, dongabda wrote:
> 
>>
>> Yes, I'm using the excepcionListener and onException, but any  
>> exception is
>> captured when the PC lost the network link. If I stop the  
>> messagebroker the
>> exception occurs, but with link lost not. How can I resolve it?
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Reconnection-tp22663516p22677750.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
> 
> ---
> Mit freundlichen Grüssen - Kind Regards
> Andreas Gies
> Principal Consultant
> Open Source Center of Competence
> 
> Progress Software GmbH
> Agrippinawerft 26
> 50678 Köln
> 
> E-Mail      	agies@progress.com
> Direct Line 	+49 (0)9953 980349
> Mobile      	+49 (0)170 5759611
> Skype        	+44 (0)20 3239 2922
> Skype       	+353 (0)1 443 4971
> Skype       	+1 (0)781 262 0168
> 
> http://www.progress.com
> http://fusesource.com
> http://open-source-adventures.blogspot.com
> 
> 
> 
> -------------------------------------------------------
> Progress Software GmbH
> Sitz der Gesellschaft: Agrippinawerft 26, 50678 Koeln;
> Niederlassung: Fuerstenrieder Str. 279, 81377 Muenchen
> Amtsgericht Koeln, HRB 15620;
> Geschaeftsfuehrung: David Ireland
> -------------------------------------------------------
> 
> 

-- 
View this message in context: http://www.nabble.com/Reconnection-tp22663516p22904398.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.