ActiveMQ MQTT Producer未发布到openwire订阅者

时间:2017-04-11 13:32:00

标签: activemq mqtt

我试图测试ActiveMQ协议包装器。 我用Eclipse Paho 1.0.2编写了一个MQTT客户端 openwire客户端是ActiveMQ客户端。 而Broker是ActiveMQ版本5.14.4。

所有使用主题和订阅者的客户

从MQTT客户端到MQTT客户端的通信工作完成,以及Openwire客户端。

但是如果我尝试从MQTT发送到Openwire,则Openwire客户端不会从MQTT客户端获取消息。从Openwire发布到MQTT是完美的。 我已经尝试了所有不同的qos设置。

来自ActiveMQ的我的配置是标准配置

<transportConnectors>
        <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
        <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"  updateClusterClients="true" updateClusterClientsOnRemove="true" rebalanceClusterClients="true"/>
        <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600" updateClusterClients="true" updateClusterClientsOnRemove="true" rebalanceClusterClients="true"/>
        <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600" updateClusterClients="true" updateClusterClientsOnRemove="true" rebalanceClusterClients="true"/>
        <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600" updateClusterClients="true" updateClusterClientsOnRemove="true" rebalanceClusterClients="true"/>
        <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600" updateClusterClients="true" updateClusterClientsOnRemove="true" rebalanceClusterClients="true"/>
    </transportConnectors>

发布代码与原始paho样本类似:

MqttClient sampleClient = new MqttClient(broker, clientId, persistence);
            MqttConnectOptions connOpts = new MqttConnectOptions();
            connOpts.setCleanSession(true);
            System.out.println("Connecting to broker: "+broker);
            sampleClient.connect(connOpts);
            System.out.println("Connected");
            System.out.println("Publishing message: "+content);
            MqttMessage message = new MqttMessage(content.getBytes());
            message.setQos(qos);
            sampleClient.publish(topic, message);
            System.out.println("Message published");
            sampleClient.disconnect();
            System.out.println("Disconnected");
            System.exit(0);

任何身体错误或者这是正常的吗?

0 个答案:

没有答案