Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Facing issue with sending message from cloud to device iot hub via rabbitmq(amqp protocol)

$
0
0
//send.php<?php
        require_once __DIR__ .'/vendor/autoload.php';usePhpAmqpLib\Connection\AMQPStreamConnection;usePhpAmqpLib\Message\AMQPMessage;

    $connection =newAMQPStreamConnection('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 =newAMQPMessage($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


Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>