Python Producer Message to InfluxDB v2 sink connector #22558
Unanswered
smuehlmann
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
i have problems to send a message with a python producer which should be processed by an InfluxDB v2 sink connector. Especially the message content / payload in combination with the used producer schema is my problem. The Pulsar Version is 3.2.2.
With java code it is possible.
Java class:
public class Device {
public String measurement;
public long timestamp;
public Map<String, String> tags;
public Map<String, Object> fields;
}
Set values:
Device device = new Device();
device.measurement = "test5";
device.timestamp = Instant.now().toEpochMilli();
device.tags = Maps.newHashMap();
device.tags.put("foo", "bar");
device.fields = Maps.newHashMap();
device.fields.put("temp", 14.8);
Create producer:
Producer producer = client.newProducer(JSONSchema.of(Device.class))
.topic("persistent://public/default/foobar")
.producerName("test")
.create();
Send message:
MessageId msgID = producer.newMessage()
.key("test")
.value(device)
.send();
Any suggestions how to do with Python ?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions