{"id":8975,"date":"2025-04-18T17:03:07","date_gmt":"2025-04-18T09:03:07","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/8975.html"},"modified":"2025-04-18T17:03:07","modified_gmt":"2025-04-18T09:03:07","slug":"windows%e4%b8%8a%e5%ae%89%e8%a3%85emqx%e4%bd%9c%e4%b8%bamqtt%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%bb%a5%e5%8f%8a%e9%85%8d%e7%bd%aemqttx%e5%ae%a2%e6%88%b7%e7%ab%af","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/8975.html","title":{"rendered":"Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef"},"content":{"rendered":"<h2>\u4e00\u3001\u5b89\u88c5EMQX MQTT\u670d\u52a1\u5668<\/h2>\n<p>EMQX \u662f\u4e00\u4e2a\u9ad8\u6027\u80fd\u3001\u53ef\u6269\u5c55\u7684\u7269\u8054\u7f51\u6d88\u606f\u4e2d\u95f4\u4ef6&#xff0c;EMQX \u5b9e\u73b0\u4e86 MQTT \u534f\u8bae\u7684\u670d\u52a1\u5668\u7aef&#xff0c;\u5373 MQTT Broker&#xff0c;\u5b83\u8d1f\u8d23\u63a5\u6536\u6765\u81ea\u5ba2\u6237\u7aef\u7684\u8fde\u63a5\u8bf7\u6c42&#xff0c;\u5904\u7406\u8ba2\u9605\u3001\u53d1\u5e03\u6d88\u606f&#xff0c;\u5e76\u5c06\u6d88\u606f\u8f6c\u53d1\u7ed9\u76f8\u5e94\u7684\u8ba2\u9605\u8005\u3002<\/p>\n<p>\u4e0b\u8f7dEMQX<\/p>\n<p>EMQX\u5b98\u65b9\u7f51\u7ad9 https:\/\/www.emqx.com\/zh\/try?product&#061;broker \u63d0\u4f9b\u4e86EMQX\u5f00\u6e90\u7248\u8f6f\u4ef6\u5305<\/p>\n<p>\u4f46\u662f5.3.2\u7248\u672c\u4ee5\u540e\u5c31\u6ca1\u6709\u63d0\u4f9bWindows\u7cfb\u7edf\u8f6f\u4ef6\u5305&#xff0c;\u9700\u8981\u5230\u8fd9\u91cc\u4e0b\u8f7dhttps:\/\/www.emqx.com\/zh\/downloads\/broker<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090259-68021543a815b.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u89e3\u538b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090259-68021543b2d39.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u914d\u7f6eEMQX&#xff0c;EMQX\u7684\u914d\u7f6e\u6587\u4ef6\u4f4d\u4e8eetc\\\\emqx.conf&#xff0c;\u53ef\u4ee5\u6839\u636e\u9700\u8981\u4fee\u6539\u914d\u7f6e\u6587\u4ef6&#xff0c;\u4f8b\u5982\u66f4\u6539\u7aef\u53e3\u53f7\u3001\u6dfb\u52a0\u63d2\u4ef6\u7b49<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090259-68021543c2489.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u542f\u52a8EMQX&#xff0c;\u8fdb\u5165\\\\bin\u76ee\u5f55\u4e0b&#xff0c;\u542f\u52a8cmd\u8f93\u5165emqx start<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090259-68021543d0f70.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u68c0\u67e5\u542f\u52a8\u72b6\u6001emqx_ctl status <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090259-68021543d9ae7.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u53ef\u4ee5\u5728\u4efb\u52a1\u7ba1\u7406\u5668\u4e2d\u770b\u5230erl.exe\u662f\u5426\u8fd0\u884c<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090259-68021543e2237.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u8bbf\u95eeEMQX Dashboard&#xff0c;\u542f\u52a8EMQX \u540e&#xff0c;\u8fdb\u5165http:\/\/127.0.0.1:18083\u4e2d&#xff0c;\u5e10\u53f7admin&#xff0c;\u5bc6\u7801public 8083 MQTT\/WebSocket \u7aef\u53e3 18083 EMQX Dashboard \u7ba1\u7406\u63a7\u5236\u53f0\u7aef\u53e3 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090300-680215443df6a.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u767b\u5f55\u540e\u53f3\u4e0a\u89d2\u8bbe\u7f6e&#xff0c;\u53ef\u4ee5\u5207\u6362\u6210\u7b80\u4f53\u4e2d\u6587<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090300-68021544c1f81.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u53f3\u4fa7\u680f\u7b2c\u4e00\u4e2a\u83dc\u5355&#xff0c;\u53ef\u67e5\u770b\u96c6\u7fa4\u6982\u89c8<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090301-680215454e9ab.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u53f3\u4fa7\u680f\u7b2c\u4e8c\u4e2a\u83dc\u5355&#xff0c;\u9009\u62e9\u5ba2\u6237\u7aef\u8ba4\u8bc1&#xff0c;\u521b\u5efa\u5ba2\u6237\u7aef\u8ba4\u8bc1&#xff0c;\u9009\u62e9\u5185\u7f6e\u6570\u636e\u5e93&#xff0c;\u9ed8\u8ba4\u53c2\u6570\u914d\u7f6e<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090301-68021545d0599.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090302-680215465a68f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090302-68021546d98a6.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090303-6802154764ef4.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u9009\u62e9\u7528\u6237\u7ba1\u7406&#xff0c;\u6dfb\u52a0\u7528\u6237\u8d26\u53f7&#xff1a;admin \u5bc6\u7801&#xff1a;public<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090303-68021547e36a1.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090304-680215486d980.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090304-68021548ec5f8.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h2>\u4e8c\u3001\u5b89\u88c5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef<\/h2>\n<p>MQTTX \u5219\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684 MQTT \u5ba2\u6237\u7aef\u5de5\u5177&#xff0c;\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u548c\u8c03\u8bd5 MQTT \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u4e0b\u8f7dMQTTX<\/p>\n<p>\u8bbf\u95eeMQTTX\u7684\u5b98\u65b9\u4e0b\u8f7d\u9875\u9762https:\/\/mqttx.app\/zh<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090305-6802154977ec4.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u53cc\u51fb\u4e0b\u8f7d\u7684exe\u6587\u4ef6&#xff0c;\u9009\u62e9\u5b89\u88c5\u76ee\u5f55\u5e76\u70b9\u51fb\u5b8c\u6210<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090306-6802154a040b4.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090306-6802154a14cda.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u914d\u7f6e\u8fde\u63a5\u5230EMQX<\/p>\n<p>\u5728MQTTX\u4e2d\u70b9\u51fb\u201c&#043;\u201d\u6dfb\u52a0\u65b0\u7684\u8fde\u63a5&#xff0c;\u8f93\u5165\u8fde\u63a5\u540d\u79f0&#xff0c;\u5982\u201cEMQX Server\u201d&#xff0c;\u670d\u52a1\u5668\u5730\u5740\u586b\u5199\u4e3a localhost \u6216\u4f60\u7684EMQX\u670d\u52a1\u5668\u7684\u5b9e\u9645IP\u5730\u5740&#xff0c;\u7aef\u53e3\u9ed8\u8ba4\u4e3a 1883&#xff0c;\u5982\u679cEMQX\u914d\u7f6e\u4e86SSL\/TLS&#xff0c;\u5e94\u4f7f\u7528 8883&#xff0c;\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801&#xff08;\u5982\u679cEMQX\u914d\u7f6e\u4e86\u8ba4\u8bc1&#xff09;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090306-6802154a64530.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u70b9\u51fb\u8fde\u63a5&#xff0c;\u53ef\u4ee5\u5f00\u59cb\u8ba2\u9605\u4e3b\u9898\u3001\u53d1\u5e03\u6d88\u606f\u7b49\u64cd\u4f5c\u6765\u6d4b\u8bd5MQTT\u901a\u4fe1\u3002 <img decoding=\"async\" src=\"2025-04-185r52ketfxjr.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p><img decoding=\"async\" src=\"2025-04-18awnljbvz1cw.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u5728EMQX Dashboard\u53ef\u4ee5\u770b\u5230\u5ba2\u6237\u7aef\u5df2\u7ecf\u8fde\u63a5\u6210\u529f\u3002 <img decoding=\"async\" src=\"2025-04-18sjzum4bqrwm.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u8fdb\u5165\u5230WebSocket \u5ba2\u6237\u7aef&#xff0c;\u53ef\u4ee5\u8fdb\u884c\u8ba2\u9605\u548c\u53d1\u5e03\u7684\u6d4b\u8bd5 <img decoding=\"async\" src=\"2025-04-18gwxpjzpb4fo.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> <img decoding=\"async\" src=\"2025-04-18dojkwoynz01.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h2>\u4e09\u3001EMQX\u76ee\u5f55\u7ed3\u6784<\/h2>\n<p>\u5f15\u7528\u81ea&#xff1a;https:\/\/www.cnblogs.com\/yking\/p\/15702684.html<\/p>\n<p>\u4e0d\u540c\u5b89\u88c5\u65b9\u5f0f\u5f97\u5230\u7684 EMQ X \u5176\u76ee\u5f55\u7ed3\u6784\u4f1a\u6709\u6240\u4e0d\u540c&#xff0c;\u5177\u4f53\u5982\u4e0b&#xff1a;<\/p>\n<table>\n<tr>\u63cf\u8ff0\u4f7f\u7528 ZIP \u538b\u7f29\u5305\u5b89\u88c5\u4f7f\u7528\u4e8c\u8fdb\u5236\u5305\u5b89\u88c5Homebrew(MacOS)\u5b89\u88c5<\/tr>\n<tbody>\n<tr>\n<td>\u53ef\u6267\u884c\u6587\u4ef6\u76ee\u5f55<\/td>\n<td>.\/bin<\/td>\n<td>\/usr\/lib\/emqx\/bin<\/td>\n<td>\/usr\/local\/bin<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u6587\u4ef6<\/td>\n<td>.\/data<\/td>\n<td>\/var\/lib\/emqx\/data<\/td>\n<td>\/usr\/local\/Cellar\/emqx\/*\/data<\/td>\n<\/tr>\n<tr>\n<td>Erlang \u865a\u62df\u673a\u6587\u4ef6<\/td>\n<td>.\/erts-*<\/td>\n<td>\/usr\/lib\/emqx\/erts-*<\/td>\n<td>\/usr\/local\/Cellar\/emqx\/*\/erts-<\/td>\n<\/tr>\n<tr>\n<td>\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55<\/td>\n<td>.\/etc<\/td>\n<td>\/etc\/emqx\/etc<\/td>\n<td>\/usr\/local\/Cellar\/emqx\/*\/etc<\/td>\n<\/tr>\n<tr>\n<td>\u4f9d\u8d56\u9879\u76ee\u5f55<\/td>\n<td>.\/lib<\/td>\n<td>\/usr\/lib\/emqx\/lib<\/td>\n<td>\/usr\/local\/Cellar\/emqx\/*\/lib<\/td>\n<\/tr>\n<tr>\n<td>\u65e5\u5fd7\u6587\u4ef6<\/td>\n<td>.\/log<\/td>\n<td>\/var\/log\/emqx<\/td>\n<td>\/usr\/local\/Cellar\/emqx\/*\/log<\/td>\n<\/tr>\n<tr>\n<td>\u542f\u52a8\u76f8\u5173\u7684\u811a\u672c\u3001schema \u6587\u4ef6<\/td>\n<td>.\/releases<\/td>\n<td>\/usr\/lib\/emqx\/releases<\/td>\n<td>\/usr\/local\/Cellar\/emqx\/*\/releases<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ee5\u4e0a\u76ee\u5f55\u4e2d&#xff0c;\u7528\u6237\u7ecf\u5e38\u63a5\u89e6\u4e0e\u4f7f\u7528\u7684\u662f bin\u3001etc\u3001data\u3001log \u76ee\u5f55\u3002<\/p>\n<h3>bin \u76ee\u5f55<\/h3>\n<p>emqx\u3001emqx.cmd<\/p>\n<p>EMQX \u7684\u53ef\u6267\u884c\u6587\u4ef6&#xff0c;\u5177\u4f53\u4f7f\u7528\u53ef\u4ee5\u67e5\u770b \u57fa\u672c\u547d\u4ee4\u3002<\/p>\n<p>emqx_ctl\u3001emqx_ctl.cmd<\/p>\n<p>EMQX \u7ba1\u7406\u547d\u4ee4\u7684\u53ef\u6267\u884c\u6587\u4ef6&#xff0c;\u5177\u4f53\u4f7f\u7528\u53ef\u4ee5\u67e5\u770b \u7ba1\u7406\u547d\u4ee4 CLI\u3002<\/p>\n<h3>etc \u76ee\u5f55<\/h3>\n<p>EMQX \u901a\u8fc7 etc \u76ee\u5f55\u4e0b\u914d\u7f6e\u6587\u4ef6\u8fdb\u884c\u8bbe\u7f6e&#xff0c;\u4e3b\u8981\u914d\u7f6e\u6587\u4ef6\u5305\u62ec:<\/p>\n<table>\n<tr>\u914d\u7f6e\u6587\u4ef6\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>emqx.conf<\/td>\n<td>EMQX \u914d\u7f6e\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>acl.conf<\/td>\n<td>EMQX \u9ed8\u8ba4 ACL \u89c4\u5219\u914d\u7f6e\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>plugins\/*.conf<\/td>\n<td>EMQX \u5404\u7c7b\u63d2\u4ef6\u914d\u7f6e\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>certs<\/td>\n<td>EMQX SSL \u8bc1\u4e66\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>emqx.lic<\/td>\n<td>License \u6587\u4ef6\u4ec5\u9650 EMQX Enterprise<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>EMQX \u5177\u4f53\u7684\u914d\u7f6e\u5185\u5bb9\u53ef\u4ee5\u67e5\u770b \u914d\u7f6e\u9879\u3002<\/p>\n<h3>data \u76ee\u5f55<\/h3>\n<p>EMQX \u5c06\u8fd0\u884c\u6570\u636e\u5b58\u50a8\u5728 data \u76ee\u5f55\u4e0b&#xff0c;\u4e3b\u8981\u7684\u6587\u4ef6\u5305\u62ec:<\/p>\n<p>configs\/app.*.config<\/p>\n<p>EMQX \u8bfb\u53d6 etc\/emqx.conf \u548c etc\/plugins\/*.conf \u4e2d\u7684\u914d\u7f6e\u540e&#xff0c;\u8f6c\u6362\u4e3a Erlang \u539f\u751f\u914d\u7f6e\u6587\u4ef6\u683c\u5f0f&#xff0c;\u5e76\u5728\u8fd0\u884c\u65f6\u8bfb\u53d6\u5176\u4e2d\u7684\u914d\u7f6e\u3002<\/p>\n<p>loaded_plugins<\/p>\n<p>loaded_plugins \u6587\u4ef6\u8bb0\u5f55\u4e86 EMQ X \u9ed8\u8ba4\u542f\u52a8\u7684\u63d2\u4ef6\u5217\u8868&#xff0c;\u53ef\u4ee5\u4fee\u6539\u6b64\u6587\u4ef6\u4ee5\u589e\u5220\u9ed8\u8ba4\u542f\u52a8\u7684\u63d2\u4ef6\u3002loaded_plugins \u4e2d\u542f\u52a8\u9879\u683c\u5f0f\u4e3a {&lt;Plugin Name&gt;, &lt;Enabled&gt;}.&#xff0c;&lt;Enabled&gt; \u5b57\u6bb5\u4e3a\u5e03\u5c14\u7c7b\u578b&#xff0c;EMQX \u4f1a\u5728\u542f\u52a8\u65f6\u6839\u636e &lt;Enabled&gt; \u7684\u503c\u5224\u65ad\u662f\u5426\u9700\u8981\u542f\u52a8\u8be5\u63d2\u4ef6\u3002\u5173\u4e8e\u63d2\u4ef6\u7684\u66f4\u591a\u5185\u5bb9&#xff0c;\u8bf7\u67e5\u770b \u63d2\u4ef6\u3002<\/p>\n<p>$ <span class=\"token function\">cat<\/span> loaded_plugins<br \/>\n<span class=\"token punctuation\">{<\/span>emqx_management,true<span class=\"token punctuation\">}<\/span>.<br \/>\n<span class=\"token punctuation\">{<\/span>emqx_recon,true<span class=\"token punctuation\">}<\/span>.<br \/>\n<span class=\"token punctuation\">{<\/span>emqx_retainer,true<span class=\"token punctuation\">}<\/span>.<br \/>\n<span class=\"token punctuation\">{<\/span>emqx_dashboard,true<span class=\"token punctuation\">}<\/span>.<br \/>\n<span class=\"token punctuation\">{<\/span>emqx_rule_engine,true<span class=\"token punctuation\">}<\/span>.<br \/>\n<span class=\"token punctuation\">{<\/span>emqx_bridge_mqtt,false<span class=\"token punctuation\">}<\/span>.<\/p>\n<p>Mnesia<\/p>\n<p>Mnesia \u6570\u636e\u5e93\u662f Erlang \u5185\u7f6e\u7684\u4e00\u4e2a\u5206\u5e03\u5f0f DBMS&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u5b58\u50a8 Erlang \u7684\u5404\u79cd\u6570\u636e\u7ed3\u6784\u3002<\/p>\n<p>EMQX \u4f7f\u7528 Mnesia \u6570\u636e\u5e93\u5b58\u50a8\u81ea\u8eab\u8fd0\u884c\u6570\u636e&#xff0c;\u4f8b\u5982\u544a\u8b66\u8bb0\u5f55\u3001\u89c4\u5219\u5f15\u64ce\u5df2\u521b\u5efa\u7684\u8d44\u6e90\u548c\u89c4\u5219\u3001Dashbaord \u7528\u6237\u4fe1\u606f\u7b49\u6570\u636e&#xff0c;\u8fd9\u4e9b\u6570\u636e\u90fd\u5c06\u88ab\u5b58\u50a8\u5728 mnesia \u76ee\u5f55\u4e0b&#xff0c;\u56e0\u6b64\u4e00\u65e6\u5220\u9664\u8be5\u76ee\u5f55&#xff0c;\u5c06\u5bfc\u81f4 EMQX \u4e22\u5931\u6240\u6709\u4e1a\u52a1\u6570\u636e\u3002<\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7 emqx_ctl mnesia \u547d\u4ee4\u67e5\u8be2 EMQX \u4e2d Mnesia \u6570\u636e\u5e93\u7684\u7cfb\u7edf\u4fe1\u606f&#xff0c;\u5177\u4f53\u8bf7\u67e5\u770b \u7ba1\u7406\u547d\u4ee4 CLI\u3002<\/p>\n<h3>log \u76ee\u5f55<\/h3>\n<p>emqx.log.*<\/p>\n<p>EMQX \u8fd0\u884c\u65f6\u4ea7\u751f\u7684\u65e5\u5fd7\u6587\u4ef6&#xff0c;\u5177\u4f53\u8bf7\u67e5\u770b \u65e5\u5fd7\u4e0e\u8ffd\u8e2a\u3002<\/p>\n<p>crash.dump<\/p>\n<p>EMQX \u7684\u5d29\u6e83\u8f6c\u50a8\u6587\u4ef6&#xff0c;\u53ef\u4ee5\u901a\u8fc7 etc\/emqx.conf \u4fee\u6539\u914d\u7f6e&#xff0c;\u5177\u4f53\u5185\u5bb9\u53ef\u4ee5\u67e5\u770b \u914d\u7f6e\u9879\u3002<\/p>\n<p>erlang.log.*<\/p>\n<p>\u4ee5 emqx start \u65b9\u5f0f\u540e\u53f0\u542f\u52a8 EMQX \u65f6&#xff0c;\u63a7\u5236\u53f0\u65e5\u5fd7\u7684\u526f\u672c\u6587\u4ef6\u3002<\/p>\n<h2>\u56db\u3001\u4f7f\u7528 Java SDK \u8fde\u63a5<\/h2>\n<p>\u5f15\u7528\u81ea&#xff1a;https:\/\/docs.emqx.com\/zh\/emqx\/latest\/connect-emqx\/java.html<\/p>\n<p>Eclipse Paho Java Client \u662f\u7528 Java \u7f16\u5199\u7684 MQTT \u5ba2\u6237\u7aef\u5e93&#xff08;MQTT Java Client&#xff09;&#xff0c;\u53ef\u7528\u4e8e JVM \u6216\u5176\u4ed6 Java \u517c\u5bb9\u5e73\u53f0&#xff08;\u4f8b\u5982Android&#xff09;\u3002<\/p>\n<p>Eclipse Paho Java Client \u63d0\u4f9b\u4e86MqttAsyncClient \u548c MqttClient \u5f02\u6b65\u548c\u540c\u6b65 API\u3002<\/p>\n<p>\u901a\u8fc7 Maven \u5b89\u88c5 Paho Java<\/p>\n<p>\u901a\u8fc7\u5305\u7ba1\u7406\u5de5\u5177 Maven \u53ef\u4ee5\u65b9\u4fbf\u5730\u5b89\u88c5 Paho Java \u5ba2\u6237\u7aef\u5e93&#xff0c;\u622a\u6b62\u76ee\u524d\u6700\u65b0\u7248\u672c\u5b89\u88c5\u5982\u4e0b&#xff1a;<\/p>\n<p><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;<\/span>dependency<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><br \/>\n  <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;<\/span>groupId<\/span><span class=\"token punctuation\">&gt;<\/span><\/span>org.eclipse.paho<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;\/<\/span>groupId<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><br \/>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;<\/span>artifactId<\/span><span class=\"token punctuation\">&gt;<\/span><\/span>org.eclipse.paho.client.mqttv3<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;\/<\/span>artifactId<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><br \/>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;<\/span>version<\/span><span class=\"token punctuation\">&gt;<\/span><\/span>1.2.2<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;\/<\/span>version<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><br \/>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;\/<\/span>dependency<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><\/p>\n<p>Paho Java \u4f7f\u7528\u793a\u4f8b<\/p>\n<p>Java \u4f53\u7cfb\u4e2d Paho Java \u662f\u6bd4\u8f83\u7a33\u5b9a\u3001\u5e7f\u6cdb\u5e94\u7528\u7684 MQTT \u5ba2\u6237\u7aef\u5e93&#xff0c;\u672c\u793a\u4f8b\u5305\u542b Java \u8bed\u8a00\u7684 Paho Java \u8fde\u63a5 EMQX Broker&#xff0c;\u5e76\u8fdb\u884c\u6d88\u606f\u6536\u53d1\u5b8c\u6574\u4ee3\u7801&#xff1a;<\/p>\n<p>App.java<\/p>\n<p><span class=\"token keyword\">package<\/span> <span class=\"token namespace\">io<span class=\"token punctuation\">.<\/span>emqx<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>eclipse<span class=\"token punctuation\">.<\/span>paho<span class=\"token punctuation\">.<\/span>client<span class=\"token punctuation\">.<\/span>mqttv3<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">MqttClient<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>eclipse<span class=\"token punctuation\">.<\/span>paho<span class=\"token punctuation\">.<\/span>client<span class=\"token punctuation\">.<\/span>mqttv3<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">MqttConnectOptions<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>eclipse<span class=\"token punctuation\">.<\/span>paho<span class=\"token punctuation\">.<\/span>client<span class=\"token punctuation\">.<\/span>mqttv3<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">MqttException<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>eclipse<span class=\"token punctuation\">.<\/span>paho<span class=\"token punctuation\">.<\/span>client<span class=\"token punctuation\">.<\/span>mqttv3<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">MqttMessage<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>eclipse<span class=\"token punctuation\">.<\/span>paho<span class=\"token punctuation\">.<\/span>client<span class=\"token punctuation\">.<\/span>mqttv3<span class=\"token punctuation\">.<\/span>persist<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">MemoryPersistence<\/span><\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">App<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">String<\/span> subTopic <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;testtopic\/#&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">String<\/span> pubTopic <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;testtopic\/1&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">String<\/span> content <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;Hello World&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">int<\/span> qos <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">String<\/span> broker <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;tcp:\/\/broker.emqx.io:1883&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">String<\/span> clientId <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;emqx_test&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">MemoryPersistence<\/span> persistence <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">MemoryPersistence<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token class-name\">MqttClient<\/span> client <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">MqttClient<\/span><span class=\"token punctuation\">(<\/span>broker<span class=\"token punctuation\">,<\/span> clientId<span class=\"token punctuation\">,<\/span> persistence<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>            <span class=\"token comment\">\/\/ MQTT \u8fde\u63a5\u9009\u9879<\/span><br \/>\n            <span class=\"token class-name\">MqttConnectOptions<\/span> connOpts <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">MqttConnectOptions<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            connOpts<span class=\"token punctuation\">.<\/span><span class=\"token function\">setUserName<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;emqx_test&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            connOpts<span class=\"token punctuation\">.<\/span><span class=\"token function\">setPassword<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;emqx_test_password&#034;<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">toCharArray<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u4fdd\u7559\u4f1a\u8bdd<\/span><br \/>\n            connOpts<span class=\"token punctuation\">.<\/span><span class=\"token function\">setCleanSession<\/span><span class=\"token punctuation\">(<\/span><span class=\"token boolean\">true<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>            <span class=\"token comment\">\/\/ \u8bbe\u7f6e\u56de\u8c03<\/span><br \/>\n            client<span class=\"token punctuation\">.<\/span><span class=\"token function\">setCallback<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">new<\/span> <span class=\"token class-name\">PushCallback<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>            <span class=\"token comment\">\/\/ \u5efa\u7acb\u8fde\u63a5<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Connecting to broker: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> broker<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            client<span class=\"token punctuation\">.<\/span><span class=\"token function\">connect<\/span><span class=\"token punctuation\">(<\/span>connOpts<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Connected&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Publishing message: &#034;<\/span> <span class=\"token operator\">&#043;<\/span> content<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>            <span class=\"token comment\">\/\/ \u8ba2\u9605<\/span><br \/>\n            client<span class=\"token punctuation\">.<\/span><span class=\"token function\">subscribe<\/span><span class=\"token punctuation\">(<\/span>subTopic<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>            <span class=\"token comment\">\/\/ \u6d88\u606f\u53d1\u5e03\u6240\u9700\u53c2\u6570<\/span><br \/>\n            <span class=\"token class-name\">MqttMessage<\/span> message <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">MqttMessage<\/span><span class=\"token punctuation\">(<\/span>content<span class=\"token punctuation\">.<\/span><span class=\"token function\">getBytes<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            message<span class=\"token punctuation\">.<\/span><span class=\"token function\">setQos<\/span><span class=\"token punctuation\">(<\/span>qos<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            client<span class=\"token punctuation\">.<\/span><span class=\"token function\">publish<\/span><span class=\"token punctuation\">(<\/span>pubTopic<span class=\"token punctuation\">,<\/span> message<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Message published&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>            client<span class=\"token punctuation\">.<\/span><span class=\"token function\">disconnect<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Disconnected&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            client<span class=\"token punctuation\">.<\/span><span class=\"token function\">close<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">exit<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">catch<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">MqttException<\/span> me<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;reason &#034;<\/span> <span class=\"token operator\">&#043;<\/span> me<span class=\"token punctuation\">.<\/span><span class=\"token function\">getReasonCode<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;msg &#034;<\/span> <span class=\"token operator\">&#043;<\/span> me<span class=\"token punctuation\">.<\/span><span class=\"token function\">getMessage<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;loc &#034;<\/span> <span class=\"token operator\">&#043;<\/span> me<span class=\"token punctuation\">.<\/span><span class=\"token function\">getLocalizedMessage<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;cause &#034;<\/span> <span class=\"token operator\">&#043;<\/span> me<span class=\"token punctuation\">.<\/span><span class=\"token function\">getCause<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;excep &#034;<\/span> <span class=\"token operator\">&#043;<\/span> me<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            me<span class=\"token punctuation\">.<\/span><span class=\"token function\">printStackTrace<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u56de\u8c03\u6d88\u606f\u5904\u7406\u7c7b OnMessageCallback.java<\/p>\n<p><span class=\"token keyword\">package<\/span> <span class=\"token namespace\">io<span class=\"token punctuation\">.<\/span>emqx<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>eclipse<span class=\"token punctuation\">.<\/span>paho<span class=\"token punctuation\">.<\/span>client<span class=\"token punctuation\">.<\/span>mqttv3<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">IMqttDeliveryToken<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>eclipse<span class=\"token punctuation\">.<\/span>paho<span class=\"token punctuation\">.<\/span>client<span class=\"token punctuation\">.<\/span>mqttv3<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">MqttCallback<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> <span class=\"token import\"><span class=\"token namespace\">org<span class=\"token punctuation\">.<\/span>eclipse<span class=\"token punctuation\">.<\/span>paho<span class=\"token punctuation\">.<\/span>client<span class=\"token punctuation\">.<\/span>mqttv3<span class=\"token punctuation\">.<\/span><\/span><span class=\"token class-name\">MqttMessage<\/span><\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">OnMessageCallback<\/span> <span class=\"token keyword\">implements<\/span> <span class=\"token class-name\">MqttCallback<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">connectionLost<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Throwable<\/span> cause<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u8fde\u63a5\u4e22\u5931\u540e&#xff0c;\u4e00\u822c\u5728\u8fd9\u91cc\u9762\u8fdb\u884c\u91cd\u8fde<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u8fde\u63a5\u65ad\u5f00&#xff0c;\u53ef\u4ee5\u505a\u91cd\u8fde&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">messageArrived<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span> topic<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">MqttMessage<\/span> message<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">throws<\/span> <span class=\"token class-name\">Exception<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ subscribe\u540e\u5f97\u5230\u7684\u6d88\u606f\u4f1a\u6267\u884c\u5230\u8fd9\u91cc\u9762<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u63a5\u6536\u6d88\u606f\u4e3b\u9898:&#034;<\/span> <span class=\"token operator\">&#043;<\/span> topic<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u63a5\u6536\u6d88\u606fQos:&#034;<\/span> <span class=\"token operator\">&#043;<\/span> message<span class=\"token punctuation\">.<\/span><span class=\"token function\">getQos<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u63a5\u6536\u6d88\u606f\u5185\u5bb9:&#034;<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">String<\/span><span class=\"token punctuation\">(<\/span>message<span class=\"token punctuation\">.<\/span><span class=\"token function\">getPayload<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">deliveryComplete<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">IMqttDeliveryToken<\/span> token<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;deliveryComplete&#8212;&#8212;&#8212;&#034;<\/span> <span class=\"token operator\">&#043;<\/span> token<span class=\"token punctuation\">.<\/span><span class=\"token function\">isComplete<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1w\u6b21\uff0c\u70b9\u8d5e32\u6b21\uff0c\u6536\u85cf97\u6b21\u3002Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef_emqxwindows\u7248\u672c<\/p>\n","protected":false},"author":2,"featured_media":8955,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[149,246,43,44],"topic":[],"class_list":["post-8975","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-windows","tag-246","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/8975.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1w\u6b21\uff0c\u70b9\u8d5e32\u6b21\uff0c\u6536\u85cf97\u6b21\u3002Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef_emqxwindows\u7248\u672c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/8975.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T09:03:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090259-68021543a815b.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/8975.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/8975.html\",\"name\":\"Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T09:03:07+00:00\",\"dateModified\":\"2025-04-18T09:03:07+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/8975.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/8975.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/8975.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/8975.html","og_locale":"zh_CN","og_type":"article","og_title":"Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1w\u6b21\uff0c\u70b9\u8d5e32\u6b21\uff0c\u6536\u85cf97\u6b21\u3002Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef_emqxwindows\u7248\u672c","og_url":"https:\/\/www.wsisp.com\/helps\/8975.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T09:03:07+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418090259-68021543a815b.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/8975.html","url":"https:\/\/www.wsisp.com\/helps\/8975.html","name":"Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T09:03:07+00:00","dateModified":"2025-04-18T09:03:07+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/8975.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/8975.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/8975.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Windows\u4e0a\u5b89\u88c5EMQX\u4f5c\u4e3aMQTT\u670d\u52a1\u5668\u4ee5\u53ca\u914d\u7f6eMQTTX\u5ba2\u6237\u7aef"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/8975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=8975"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/8975\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/8955"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=8975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=8975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=8975"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=8975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}