我正在尝试使用适用于 .NET 的 Apache NMS API 通过 ActiveMQ 通过 SSL 发送安全消息。
在 broker.xml 中,我尝试将“sslEnabled=true”添加到默认接受器:
<acceptor name="artemis">tcp://0.0.0.0:61616?sslEnabled=true;tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300</acceptor>
我正在尝试设置这样的消费者:
IConnectionFactory factory = new ConnectionFactory("activemq:tcp://localhost:61616");
connection = (Connection)factory.CreateConnection();
connection.Start();
ISession session = connection.CreateSession();
IDestination destination = session.GetTopic("topic1");
consumer = session.CreateConsumer(destination);
consumer.Listener += new MessageListener(HandleMessage);
当代码到达 lineconnection.Start()
时,我得到了这个异常:
频道太长时间处于非活动状态:tcp://localhost:61616/
我曾尝试像这样更改连接 url(中间是 ssl 而不是 tcp):
IConnectionFactory factory = new ConnectionFactory("activemq:ssl://localhost:61616");
然后我得到了这个例外:
无法从传输连接读取数据:已建立的连接被主机中的软件中止
我在这里做错了什么?如何发送和接收安全消息?