[ https://jira.fiware.org/browse/HELP-19679?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fernando Lopez reassigned HELP-19679:
-------------------------------------
Assignee: Jason Fox
> [fiware-stackoverflow] FIWARE ORION MONGODB
> -------------------------------------------
>
> Key: HELP-19679
> URL: https://jira.fiware.org/browse/HELP-19679
> Project: Help-Desk
> Issue Type: Monitor
> Components: FIWARE-TECH-HELP
> Reporter: Backlog Manager
> Assignee: Jason Fox
> Labels: fiware
>
> Created question in FIWARE Q/A platform on 06-06-2022 at 14:06
> {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/72518900/fiware-orion-mongodb
> +Question:+
> FIWARE ORION MONGODB
> +Description:+
> I want to set up my Raspberry Pi as a publisher of data(using MQTT).
> Here is an example of the publisher code(in Python):
> # File: sipub.py
> #
> # The simplest MQTT producer.
> import random
> import time
> import paho.mqtt.client as mqtt
> THE_BROKER = "test.mosquitto.org"
> THE_TOPIC = "PMtest/rndvalue"
> CLIENT_ID = ""
> # The callback for when the client receives a CONNACK response from the server.
> def on_connect(client, userdata, flags, rc):
> print("Connected to ", client._host, "port: ", client._port)
> print("Flags: ", flags, "returned code: ", rc)
> # The callback for when a message is published.
> def on_publish(client, userdata, mid):
> print("sipub: msg published (mid={})".format(mid))
> client = mqtt.Client(client_id=CLIENT_ID,
> clean_session=True,
> userdata=None,
> protocol=mqtt.MQTTv311,
> transport="tcp")
> client.on_connect = on_connect
> client.on_publish = on_publish
> client.username_pw_set(None, password=None)
> client.connect(THE_BROKER, port=1883, keepalive=60)
> client.loop_start()
> while True:
> msg_to_be_sent = random.randint(0, 100)
> client.publish(THE_TOPIC,
> payload=msg_to_be_sent,
> qos=0,
> retain=False)
> time.sleep(15)
> client.loop_stop()
> And I want to set up a subscriber to be ORION that is running as a docker container on the port 1026. That uses mongoDB that is also running as a container on the port: 27017.
> Can someone give me a hint? Please?
> Thank you very much!
--
This message was sent by Atlassian JIRA
(v6.4.1#64016)
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy