0

I have tried to use ActiveMQ as Microsoft Service Bus. I configured ssl layer on activemq and also $cbs queue has been already created by an c# application using azure servicebus SDK.

But when I tried to use azure IotHub SDK C for my device, it seems that I should pass activemq username and password . How can I change the iothubtransport_amqp_common.c to connect my device to ActiveMQ.

I could connect to Azure IoTHub by using amqpnetlite. If I wanted to connect to activeMQ, I should pass Username and Password. And it works OK. so I want to know: in azure iot sdk how can I pass these 2 options(Username and Password)?

  • There is not enough information to go on here.. you'd need to share relevant log statements and/or the source of the program. From the name of your source program, it looks like it is trying to connect using the AMQP protocol. Check this out: http://activemq.apache.org/amqp.html – Matt Pavlovich Jul 11 '17 at 17:31
  • I don't have issue with **activeMQ** configuration. I could connect to **Azure IoTHub** by using [amqpnetlite](https://github.com/Azure/amqpnetlite). If I wanted to connect to **activeMQ**, I should pass _Username_ and _Password_. And it works __OK__. so I want to know: in [azure iot sdk](https://github.com/Azure/azure-iot-sdk-c) how can I pass these 2 options(_Username_ and _Password_)? – Mohammad Eskandari Jul 12 '17 at 13:08

1 Answers1

0

Azure iothub sdk using MSSBCBS for sasl mechanism but activeMQ uses PLAIN sasl. so for passing username and password, we should use PLAIN sasl. for changing the sasl mechanism you can edit this file: azure-iot-sdk-c/iothub_client/src/iothubtransport_amqp_connection.c in line 49 instead of :

if ((sasl_mechanism = saslmechanism_create(saslmssbcbs_get_interface(), NULL)) == NULL)

put:

 SASL_PLAIN_CONFIG sasl_plain_config;
            sasl_plain_config.authcid = "username";
            sasl_plain_config.authzid = NULL;
            sasl_plain_config.passwd = "password";

 if ((sasl_mechanism = saslmechanism_create(saslplain_get_interface(), &sasl_plain_config)) == NULL)

You also need to add #include "azure_uamqp_c/sasl_plain.h"