How to work with MQTT in Wildfly

帅比萌擦擦* 提交于 2019-12-22 17:53:57

问题


I am working on a platform to monitor and control devices which use MQTT for the communication layer. I use REST endpoints for the Angular2 based SPA Web. The backend is developed in JEE using WildFly which support out of the box the MQTT protocol through is JMS Broker(Active MQ).

I am new in JEE and don’t know a lot of things:
- I have never used the JMS System
- I can’t find any information o tutorial to point me in the right way to get MQTT messages through a JMS Application.

Can you help me to build a very basic App on WildWfly which demonstrates how to consume/produce JMS Messages through MQTT?

EDIT

Based on this post (you should add manually support for other message protocol to WildFly), I tried to add MQTT support adding a mqtt module to WildFly folder on this way:

\wildfly-10.1.0.Final\modules\system\layers\base\org\apache\activemq\artemis\protocol\mqtt\main\module.xml:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="org.apache.activemq.artemis.protocol.mqtt">
    <resources>
        <resource-root path="artemis-mqtt-protocol-1.3.0.jar"/>
        <resource-root path="netty-codec-mqtt-4.1.5.Final"/>
    </resources>

    <dependencies>
        <!-- required to load ActiveMQ protocol SPI -->
        <module name="org.apache.activemq.artemis"/>
    </dependencies>
</module>

I also added the resource jars to the folder.

\wildfly-10.1.0.Final\modules\system\layers\base\org\apache\activemq\artemis\main\module.xml:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="org.apache.activemq.artemis">
    ....
    <dependencies>
        ...
        <module name="org.apache.activemq.artemis.protocol.mqtt" services="import" optional="true"/>
        ...
    </dependencies>
</module>

But when a run WildFly, I cant see on the output

Adding protocol support for: MQTT

WildFly output

来源:https://stackoverflow.com/questions/39427558/how-to-work-with-mqtt-in-wildfly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!