本文介绍了无法识别运输方案:[amqp]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将AMQP与ActiveMQ结合使用并遇到以下错误

Am trying to use AMQP with ActiveMQ and am getting the following error

Transport scheme NOT recognized: [amqp]

这是我的代码

ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
        "amqp://localhost:61616");

Connection connection = null;
try {
    connection = connectionFactory.createConnection();
    connection.start();

    Session session = connection.createSession(false,
            Session.AUTO_ACKNOWLEDGE);

    Queue queue = session.createQueue("somequeue");

    MessageProducer producer = session.createProducer(queue);

    // We will send a small text message saying 'Hello'
    TextMessage message = session.createTextMessage();
    message.setText("Publishing : New Message ");
    producer.send(message);

    connection.close();
} catch (Exception e) {

}


推荐答案

请注意,ActiveMQ中的AMQP仅在服务器中实现,而不在JMS客户端中实现。 JMS客户端实际上实现了默认的 OpenWire协议(以及JVM内传输)。

Please note that AMQP in ActiveMQ is implemented in the Server only and not in the JMS client. The JMS client actually implements the "default" OpenWire protocol (and the intra-JVM transport).

您应该使用AMQP等其他客户端库与ActiveMQ进行通信,例如作为,即。

You should use some other client library to communicate with ActiveMQ using AMQP, such as Apache QPID which is recommended by ActiveMQ.

这篇关于无法识别运输方案:[amqp]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 19:30