打印

edgex:连接一个应用

[复制链接]
320|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
keer_zu|  楼主 | 2020-12-8 11:40 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
edge, ic, AN, ui, ST


1.4. Connecting an ApplicationEdgeX provides exporters for a variety of cloud services and application. To keep this guide simple, we’re going to use a public MQTT broker hosted by HiveMQ, then watch for our EdgeX readings to be pushed to it automatically.
To register the application as an export client, run:
<span class="n">curl</span> <span class="o">-</span><span class="n">X</span> <span class="n">POST</span> <span class="o">-</span><span class="n">d</span> <span class="s1">'{</span>
    <span class="s2">"name"</span><span class="p">:</span><span class="s2">"QuickStartExport"</span><span class="p">,</span>
    <span class="s2">"addressable"</span><span class="p">:{</span>
        <span class="s2">"name"</span><span class="p">:</span><span class="s2">"HiveMQBroker"</span><span class="p">,</span>
        <span class="s2">"protocol"</span><span class="p">:</span><span class="s2">"tcp"</span><span class="p">,</span>
        <span class="s2">"address"</span><span class="p">:</span><span class="s2">"broker.hivemq.com"</span><span class="p">,</span>
        <span class="s2">"port"</span><span class="p">:</span><span class="mi">1883</span><span class="p">,</span>
        <span class="s2">"publisher"</span><span class="p">:</span><span class="s2">"EdgeXExportPublisher"</span><span class="p">,</span>
        <span class="s2">"topic"</span><span class="p">:</span><span class="s2">"EdgeXQuickStartGuide"</span>
    <span class="p">},</span>
    <span class="s2">"format"</span><span class="p">:</span><span class="s2">"JSON"</span><span class="p">,</span>
    <span class="s2">"filter"</span><span class="p">:{</span>
        <span class="s2">"deviceIdentifiers"</span><span class="p">:[</span><span class="s2">"Random-Integer-Generator01"</span><span class="p">]</span>
    <span class="p">},</span>
    <span class="s2">"enable"</span><span class="p">:</span><span class="n">true</span><span class="p">,</span>
    <span class="s2">"destination"</span><span class="p">:</span><span class="s2">"MQTT_TOPIC"</span>
<span class="p">}</span><span class="s1">' http://localhost:48071/api/v1/registration</span>




You can connect to this broker with any MQTT client to watch the data being sent. HiveMQ provides a web-based client that you can use, simply subscribe to the “EdgeXQuickStartGuide” topic and you will begin seeing your random number readings.
You can also use the Mosquitto CLI tool to verify that readings are being sent by running:
<span class="n">mosquitto_sub</span> <span class="o">-</span><span class="n">h</span> <span class="n">broker</span><span class="o">.</span><span class="n">hivemq</span><span class="o">.</span><span class="n">com</span> <span class="o">-</span><span class="n">p</span> <span class="mi">1883</span> <span class="o">-</span><span class="n">t</span> <span class="n">EdgeXQuickStartGuide</span>







使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:qq群:49734243 Email:zukeqiang@gmail.com

1352

主题

12436

帖子

53

粉丝