我目前正在使用activemq cpp c++客户端连接到后端服务器。使用TCP协议时,可以进行通信。我在https://activemq.apache.org/components/cms/example中使用了上面的例子。但是现在我需要使用SSL协议。我的代码如下:
brokerURI =“故障转移:(ssl://xxxx:61617)”;
auto connectionFactory =新的ActiveMQConnectionFactory(brokerURI);
connectionFactory->setUsername(用户名);
connectionFactory->setPassword(password);
connection = connectionFactory->createConnection();
连接->启动();
我被start函数卡住了,没有抛出任何异常。我也不知道原因。可以给我一个简单的ssl代码连接演示给我学习吗?谢谢。
发布于 2019-05-10 03:23:01
该示例记录了您需要执行的SSL配置,即告诉库密钥存储和信任存储(以及密码)位于何处。
// 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
//
https://stackoverflow.com/questions/56056174
复制相似问题