File tree Expand file tree Collapse file tree 4 files changed +883
-3
lines changed
Expand file tree Collapse file tree 4 files changed +883
-3
lines changed Original file line number Diff line number Diff line change @@ -293,7 +293,7 @@ const getMethods = (obj) => {
293293function getFunctionNameByChannel ( channelName , channel ) {
294294 let ret = _ . camelCase ( channelName ) ;
295295 //console.log('functionName channel: ' + JSON.stringify(channelJson));
296- let functionName = channel . ext ( [ 'x-function-name' ] ) ;
296+ let functionName = channel . ext ( 'x-function-name' ) ;
297297 //console.log('function name for channel ' + channelName + ': ' + functionName);
298298 if ( functionName ) {
299299 ret = functionName ;
Original file line number Diff line number Diff line change 1+ # How to run the sample
2+
3+ ## Prerequisites
4+
5+ - Python 3 with ` pip ` and ` paho-mqtt ` preinstalled
6+ - Docker
7+
8+ ## Run the example
9+
10+ 1 . Generate the code
11+ ```
12+ ag https://raw.githubusercontent.com/asyncapi/python-paho-template/master/samples/temperature.yaml @asyncapi/python-paho-template -o ./generated_code
13+ ```
14+ 2. Patch main.py to send some data
15+ An example of code:
16+
17+ ```
18+ # Example of how to publish a message. You will have to add arguments to the constructor on the next line:
19+ payload = SensorReading("SensorId3",12,SensorReading.BaseUnit.CELSIUS)
20+ ```
21+ 3. Create Mosquitto broker configuration
22+
23+ Get the example configuration from [here](https://github.com/asyncapi/python-paho-template/blob/master/samples/mosquitto.conf)
24+
25+ > In `mosquitto.conf` we enabled anonymous logging. This **SHOULD NOT** be the case in production.
26+
27+ 4. Install and run mosquitto MQTT broker
28+ ```
29+ docker run -it -p 0.0.0.0:1883:1883 -p 0.0.0.0:9001:9001 -v $PWD/../samples/mosquitto.conf:/mosquitto/config/mosquitto.conf eclipse-mosquitto
30+ ```
31+ 5. Configure .ini file
32+ Rename `config-template.inì` into `config.ini` and paste:
33+ ```
34+ [DEFAULT]
35+ host=127.0.0.1
36+ password=
37+ port=1883
38+ username=
39+ ```
40+ 6. Run your code
41+ ```
42+ python main.py
43+ ```
You can’t perform that action at this time.
0 commit comments