activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jorge.medra" <jorge.omar.me...@gmail.com>
Subject SSL Connection with ActiveMQ-CPP 3.4.5 and 3.5.0 in OSX
Date Wed, 16 Jan 2013 05:07:49 GMT
Hi 

I've been working fine wit active ActiveMQ and Java applications using SSL
connection but i need to create another client in C++ over OSX. I compiled
the api with the option --with-openssl, at the momento start of threat it
doesnt work. If i change the transport layer to TCP its worked fine.

Here the code to create the connection:



std::string brokerURI = "failover:(ssl://MacBook-Pro-de-Jorge.local:61617"
             "?transport.acceptInvalidBrokerCert=true)";

 // Create the consumer
 SimpleAsyncConsumer consumer( brokerURI, destURI, useTopics, clientAck );
    
 // Start it up and it will listen forever.
 consumer.runConsumer();


...

    void runConsumer() {
        
        try {
            
           decaf::lang::System::setProperty( "javax.net.ssl.keyStore",
"/Users/jorgemedra/Documents/TKQ/certificados/https/demo/demo.pem");
            
            
            // Create a ConnectionFactory
            ActiveMQConnectionFactory* connectionFactory = new
ActiveMQConnectionFactory( brokerURI );

            // Create a Connection
            connection = connectionFactory->createConnection();
            delete connectionFactory;
            
            ActiveMQConnection* amqConnection =
dynamic_cast<ActiveMQConnection*>( connection );
            if( amqConnection != NULL ) {
                amqConnection->addTransportListener( this );
            }
            

            //connection->setExceptionListener(this);
            amqConnection->setExceptionListener(this);

            //connection->start();
            amqConnection->start();  // *** HERE IS WHEN THE PROGRMA
FREEZING
            
        
            
            // Create a Session
            if( clientAck ) {
                session = amqConnection->createSession(
Session::CLIENT_ACKNOWLEDGE );
            } else {
                session = amqConnection->createSession(
Session::AUTO_ACKNOWLEDGE );
            }
            
            // Create the destination (Topic or Queue)
            if( useTopic ) {
                destination = session->createTopic( destURI );
            } else {
                destination = session->createQueue( destURI );
            }
            
            // Create a MessageConsumer from the Session to the Topic or
Queue
            consumer = session->createConsumer( destination );
            consumer->setMessageListener( this );
            
        } catch (CMSException& e) {
            e.printStackTrace();
        }
    }


At the moment of debug this sample the program is freezing into the line 

amqConnection->start();


The certifie that i'm using is in pem format, and i created this since a
certified that was imported from a browser. I created this wiht open ssl, as
you can see:

          openssl x509 -inform der -in demo.cert -out demo.pem


I have the same problem in ActiveMQ-Cpp V3.4.5 and 4.5.0

Cloud someone help me to make connection with SSL? what did i do wrong?

Thanks.





--
View this message in context: http://activemq.2283324.n4.nabble.com/SSL-Connection-with-ActiveMQ-CPP-3-4-5-and-3-5-0-in-OSX-tp4661808.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Mime
View raw message