0

I am currently using the activemq-cpp c++ client to connect to the backend server. When using the TCP protocol, it is possible to communicate. I am using the example above at https://activemq.apache.org/components/cms/example. But now I need to use the SSL protocol. My code is as follows:

brokerURI ="failover:(ssl://xxxx:61617)";

auto connectionFactory = new ActiveMQConnectionFactory(brokerURI);

connectionFactory->setUsername(username);

connectionFactory->setPassword(password);

connection = connectionFactory->createConnection();

connection->start();

I got stuck in the start function and didn't throw any exceptions. I don't know why. Could give me a simple c++ ssl code connection demo for me to learn? Thank you.

new a
  • 11
  • 2

1 Answers1

0

The [example][1] documents the SSL configuration that you need to do, which is to tell the library where the key store, and trust store (and password) live.

// SSL:
// =========================
// To use SSL you need to specify the location of the trusted Root CA or the
// certificate for the broker you want to connect to.  Using the Root CA allows
// you to use failover with multiple servers all using certificates signed by
// the trusted root.  If using client authentication you also need to specify
// the location of the client Certificate.
//
//     System::setProperty( "decaf.net.ssl.keyStore", "<path>/client.pem" );
//     System::setProperty( "decaf.net.ssl.keyStorePassword", "password" );
//     System::setProperty( "decaf.net.ssl.trustStore", "<path>/rootCA.pem" );
//
// The you just specify the ssl transport in the URI, for example:
//
//     ssl://localhost:61617
//
Tim Bish
  • 17,475
  • 4
  • 32
  • 42
  • Thank you very much for your help. My working environment is WIN10. I can connect directly to the ssl address by using the telnet tool. E.g telnet xxxx(ssl address) Can you tell me that this activemq-cpp must have a certificate to connect? I currently have no certificate here, only one ssl connection address – new a May 10 '19 at 07:15
  • Because that's how SSL works, without certificates it is just unsecure TCP really. – Tim Bish May 10 '19 at 13:11