面对通过rabbitmq(amqp协议)从云向设备iot集线器发送消息的问题 [英] Facing issue with sending message from cloud to device iot hub via rabbitmq(amqp protocol)

查看:211
本文介绍了面对通过rabbitmq(amqp协议)从云向设备iot集线器发送消息的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//send.php
    <?php
        require_once __DIR__ . '/vendor/autoload.php';
    use PhpAmqpLib\Connection\AMQPStreamConnection;
    use PhpAmqpLib\Message\AMQPMessage;

    $connection = new AMQPStreamConnection('HUBNAME.azure-devices.net', 5671
    , 'HUBNAME.azure-devices.net/DEVICENAME/?api-version=2018-06-30'
    , 'SharedAccessSignature sr=HUBNAME.azure-devices.net
    &sig=XXXX&se=XXXX&skn=iothubowner');

    $channel = $connection->channel();
    $channel->queue_declare('hello', false, false, false, false);
    $json = '{"id":123, "value":"xyz"}';
    $msg = new AMQPMessage($json);
    $channel->basic_publish($msg, '', 'hello');    
    echo " [x] Sent 'Hello World!'\n";    
    $channel->close();
    $connection->close();

when i run this send.php file i am getting error:
fatal error: Uncaught PhpAmqpLib\Exception\AMQPConnectionClosedException: Broken pipe or closed connection in C:\xampp\htdocs\amqp\vendor\php-amqplib\php-amqplib\PhpAmqpLib\Wire\IO\StreamIO.php:222

推荐答案

Hello Vishal,

Hello Vishal,

我们可以看到你在Stack Overflow上问了同样的问题
here

We can see that you asked the same question on Stack Overflow here.

我们将继续在那里进行故障排除以及社区的专业知识。

We will continue the troubleshooting there together with the expertise from the community.

谢谢!


这篇关于面对通过rabbitmq(amqp协议)从云向设备iot集线器发送消息的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆