Skip to content

Trying to insert data with python paho MQTT #3809

@tishacian

Description

@tishacian

Describe the bug
When trying inserting data with paho MQTT with :

import paho.mqtt.publish as publish
payload=f"""{{\n"device":"root.synox.alphitan.MD10109",\n"timestamp":100,\n"measurments":["temperature"],\n"values":[20.0]}}"""
publish.single(topic='root.synox.alphitan.MD10109', payload=payload, hostname=MQTT_IOTDB, port=MQTT_IOTDB_PORT, auth={'username':'root', 'password':'root'})

I have an error printing :

ERROR o.a.i.d.c.IoTDBDefaultThreadExceptionHandler:31 - Exception in thread pool-5-thread-5-89
java.lang.NullPointerException: null
	at org.apache.iotdb.db.mqtt.PublishHandler.onPublish(PublishHandler.java:98)
	at io.moquette.interception.BrokerInterceptor.lambda$notifyTopicPublished$3(BrokerInterceptor.java:133)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

To Reproduce
Steps to reproduce the behavior:

  1. Define a docker volume iotdb-conf with inside a modify iotdb-engine.propertiesfile with enable_mqtt_service=trueset.
  2. Deploy IotDB docker container with docker run -d -p 6667:6667 -p 31999:31999 -p 8181:8181 -p 1884:1883 -v iotdb-conf:/iotdb/conf -v iotdb-data:/iotdb/data -v iotdb-logs:/iotdb/logs --name iotdb apache/iotdb:latest
  3. Try to submit previous python code

Expected behavior
Value of 20.0 to be inserted for temperature.

Desktop (please complete the following information):

  • OS: Docker

Additional context
No error raised by publish.single, obviously I have nothing when requesting in IotDB CLI SELECT temperature FROM root.synox.alphitan.MD10109, I can only see the error in IotDB logs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions