Android amqp与Azure iothub连接

时间:2020-04-28 09:19:12

标签: android azure iot amqp azure-iot-hub

我需要将带有Android的amqp连接到天蓝色IotHub。

当前,Microsoft项目主要支持xamarin.android。

我正在尝试连接rabitmq 5.9.0(Android amqp客户端),但无法继续进行下去。

implementation 'com.rabbitmq:amqp-client:5.9.0'

我正在尝试像python中提到的例子那样连接azure:-https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-amqp-support

代码:

try
        {
            factory = new ConnectionFactory();
            factory.setAutomaticRecoveryEnabled(true);
            // factory.setUri("amqp://USERNAME:PASSWORD@SERVERIP:5672/MYHOST");
            factory.setUri("amqps://username:SharedAccessSignature:5671/operation");

        }
        catch (Exception ex)
        {
            Toast.makeText(this, "Errore: " + ex, Toast.LENGTH_SHORT).show();
        }

我得到

Error:java.illegalArgumentException:Multiple segments in path of AMQP

原因是我正在使用的操作“ / messages / events / ConsumerGroups / {consumer_group} / Partitions / {p_id}”将被ampq的ConnectionFactory类的seturi方法拆分。

有人有没有尝试过与azure iothub一起使用amqp?任何建议都会很好。

0 个答案:

没有答案