-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MQTT subscriptions with virtual host. #1576
Comments
Hola Borja, To be honest, I don't have a clue :) Not gonna be immediate though. Very busy today and next week I'll be out, working perhaps half-time. |
Okay thanks then. Also, what is Broker MQTT error -3? It happens when I publish data. If i do it with mosquito_pub and mosquito_sub works perfectly fine. Thanks or gracias! |
"Broker MQTT error -3" ... is that something you see in the logfile? |
This is the log from Orion "time=2024-03-08T12:14:46.731Z | lvl=ERROR | corr=N/A | trans= | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=mqttNotification.cpp[173]:mqttNotification | msg=MQTT Broker error -3" |
Found it.
And then found this in Paho MQTT Client docs:
|
Seems like we've lost the connection between the client (Orion-LD) and the MQTT server. |
So do you have any guess why is it disconnecting? |
Also this comes from " LM_T(LmtMqtt, ("Sending a notification over MQTT (topic: '%s')", topic)); |
If you start the broker with the proper trace levels, you'll see that one too. |
No clue as to why it's disconnecting. |
Hey, Thanks for all of this. Also just hit me up whenever vhosts are avaible as URI parameter to the orion subscription. |
By the way, I am still receiving errors of the connection to the broker:
Is it possible to assign different clientID, it seems rabbitMQ does not allow multiple connections since I have one subscription per tenant, and it is recreating the connection. Could we parametrize the clientId in the subscription body? Or does it save the orion the connection and it does not recreated it again? Thanks |
Just to also mention is there anyway of keeping alive the connection? Is there any attribute declared for keeping alive the connection? |
That's probably a bug of mine. |
The paho mqtt library supposedly does that ... |
No! :) |
Okay, it seems for me that it keeps the connection and does not reconnect if the keep alive expires |
Which is the defualt keep alive interval you have set it? |
Okay, makes totally sense indeed. Are all of the version of OrionLD pointing to the same mongoDB database name? Just in case there was an update on that. Thanks! |
Hey, here are some logs from today getting the disconnected status:
It seems that it know that the connection is not keeped alived but still I think it doest not try to reconnect. But Looking at the code `
` It seems that there is no reconnection attempt right? Thanks |
Having a look at the MqttConnection* mqttConnectionP = mqttConnectionLookup(mqttP->host, mqttP->port, mqttP->username, mqttP->password, mqttP->version); Is looking for the connection if its established. If it returns Having a look at the if (MQTTClient_isConnected(mqP->client) != true)
LM_T(LmtMqtt, ("Found the MQTT connection, just, it's not connected!"));
// Remove mqP from the list since it is not connected.
for (int j = ix; j < mqttConnectionListIx - 1; j++) {
mqttConnectionList[j] = mqttConnectionList[j + 1];
}
// decrease by one the size of the list
--mqttConnectionListIx;
// returning NULL since it is not connected
return NULL;
Returning NULL would cause on the // line 172 of mqttNotify.cpp
if (mqttConnectionP == NULL)
{
mqttConnectionP = mqttConnectionAdd(false, mqttP->username, mqttP->password, mqttP->host, mqttP->port, mqttP->version);
if (mqttConnectionP == NULL)
{
orionldError(OrionldInternalError, "MQTT Broker Problem", "unable to connect to the MQTT broker", 500);
notificationFailure(cSubP, "Unable to connect to the MQTT broker", notificationTime);
return -1;
}
}
Let me know what do you think about that, and thanks for this awesome project. |
Hello, have you had any time on reviewing this? Thanks in advance if you did. |
Hello, any update regarding this? Thanks |
Hello everyone.
First of all thanks for this awesome context broker.
Second of all, I successfully have set up an mqtt subscription with a mqtt URI. "mqtt://{username}:{password}@{host}:{port}/{topic}". The issue I am having is adding a vhost to the uri to connect the user, since I am using RabbitMQ. Typically this is done specifying the user as "{vhost}:{username}" but when trying to create that subscription, I am having errors since there are two ':'. Also I have tried to decode it and returns me the follwing error "I20240308-11:00:01.560(1)? error | [cronTask]: InvalidResponse: Unexpected error code: 500".
Is it possible to specify the uri of the mqtt subscription to a defined vhost of the rabbitmq?
Thanks
The text was updated successfully, but these errors were encountered: