Last active
February 28, 2023 17:05
-
-
Save merlin-quix/18598ca6a3ff77be7c0a5af8bf276cca to your computer and use it in GitHub Desktop.
OSS_announcement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Open the producer topic where to publish data. | |
topic_producer = client.get_topic_producer("data") | |
# Create a new stream for each device. | |
stream = topic_producer.create_stream("bus-123AAAV") | |
stream.properties.name = "BUS 123 AAAV" | |
stream.timeseries.buffer.time_span_in_milliseconds = 100 | |
print("Sending values for 30 seconds.") | |
for index in range(0, 3000): | |
stream.timeseries \ | |
.buffer \ | |
.add_timestamp(datetime.datetime.utcnow()) \ | |
.add_value("Lat", math.sin(index / 100.0) + math.sin(index) / 5.0) \ | |
.add_value("Long", math.sin(index / 200.0) + math.sin(index) / 5.0) \ | |
.publish() | |
time.sleep(0.01) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment