Skip to content

Commit

Permalink
fix(edge): mqtt error
Browse files Browse the repository at this point in the history
  • Loading branch information
ronpai committed Apr 20, 2023
1 parent 91711b5 commit 53300b9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
15 changes: 11 additions & 4 deletions src/edge/EdgeSolution/modules/kanai/app/exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,17 @@ def send_message(message):
print("Sent message: " + payload)


mqtt_client = mqtt.Client(INSTANCE, protocol=4)
mqtt_client.on_connect = on_connect
if is_iotedge():
try:
mqtt_client = mqtt.Client(INSTANCE, protocol=4)
mqtt_client.on_connect = on_connect

mqtt_client.connect("mqtt.default.svc.cluster.local", 1883, 60)
mqtt_client.connect("mqtt.default.svc.cluster.local", 1883, 60)
except Exception as e:
mqtt_client = None
print(f"MQTT client error: {e}", flush=True)
else:
mqtt_client = None


try:
Expand Down Expand Up @@ -178,7 +185,7 @@ def _exporter():
print('IotHubExport: send a message to metrics')
if iot:
iot.send_message_to_output(j, 'metrics')
else:
elif mqtt_client:
send_message(j)
except Exception as e:
print(
Expand Down
2 changes: 1 addition & 1 deletion src/edge/EdgeSolution/modules/kanai/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"image": {
"repository": "${CONTAINER_REGISTRY_NAME}/kanai",
"tag": {
"version": "0.41.44",
"version": "0.41.45",
"platforms": {
"amd64": "./dockerfiles/Dockerfile.amd64",
"gpuamd64": "./dockerfiles/Dockerfile.gpuamd64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def get_config(self):
})

# container image
kanai_version = "0.41.44"
kanai_version = "0.41.45"
# managermodule_image = f"possprod.azurecr.io/voe/managermodule:{kanai_version}-amd64"
# streamingmodule_image = f"possprod.azurecr.io/voe/streamingmodule:{kanai_version}-amd64"
# predictmodule_image = f"possprod.azurecr.io/voe/predictmodule:{kanai_version}-{image_suffix}amd64"
Expand Down
2 changes: 1 addition & 1 deletion src/portal/modules/webmodule/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.41.44
0.41.45

0 comments on commit 53300b9

Please sign in to comment.