Dojot flow node.
Project description
# dojot-flow-node-python
A Python library that allows you to integrate your own node on Dojot's [FlowBroker](https://github.com/dojot/flowbroker).
## How to build your own node
1) You need to create a class that extends the `DataHandlerBase` class, this
class is the responsable by implements your node behavior. The following methods
__must be__ implemented:
- get_node_representation_path
- get_metadata
- get_locale_data
- handle_message
2) Is necessary to create a `.html` file that describes your node. You can find how to create it using the [NodeRed documentation](https://nodered.org/docs/creating-nodes/). Dojot's FlowBroker uses the [NodeRed](https://nodered.org/) frontend.
3) You need to encapsulate your code into a docker container.
4) Publish your container in some public repository like [DockerHub](https://hub.docker.com/) or some private based on [DockerRegistry](https://docs.docker.com/registry).
5) Call the FlowBroker endpoint to add a new node. Please check the [FlowBroker documentation](https://dojot.github.io/flowbroker/apiary_latest.html) to check
how this endpoint works.
## Sample
A sample node is attached to this package to illustrate the steps described in
the previous section. It's a simple node that converts a Celcius temperature
measure into Kelvin.
### How to build
Build the docker image:
```sh
cd sample_node
docker build -t <your dockerHub username>/kelvin .
```
Publish it on your DockerHub:
```sh
docker push <your dockerHub username>/kelvin
```
Acquire a Dojot's token:
```sh
curl -X POST http://127.0.0.1:8000/auth \
-H 'Content-Type:application/json' \
-d '{"username": "admin", "passwd" : "admin"}'
```
This command will return a JWT token, you need to store it on an environment
variable:
```sh
export JWT=<the value returned>
```
Add the Kelvin node to Dojot.
```sh
curl -H "Authorization: Bearer ${JWT}" http://localhost:8000/flows/v1/node -H 'content-type: application/json' -d '{"image": "<your dockerHub username>/kelvin:latest", "id":"kelvin"}'
```
Now the Kelvin node will be available on `converters` category into the FlowBroker Dojot's interface.
A Python library that allows you to integrate your own node on Dojot's [FlowBroker](https://github.com/dojot/flowbroker).
## How to build your own node
1) You need to create a class that extends the `DataHandlerBase` class, this
class is the responsable by implements your node behavior. The following methods
__must be__ implemented:
- get_node_representation_path
- get_metadata
- get_locale_data
- handle_message
2) Is necessary to create a `.html` file that describes your node. You can find how to create it using the [NodeRed documentation](https://nodered.org/docs/creating-nodes/). Dojot's FlowBroker uses the [NodeRed](https://nodered.org/) frontend.
3) You need to encapsulate your code into a docker container.
4) Publish your container in some public repository like [DockerHub](https://hub.docker.com/) or some private based on [DockerRegistry](https://docs.docker.com/registry).
5) Call the FlowBroker endpoint to add a new node. Please check the [FlowBroker documentation](https://dojot.github.io/flowbroker/apiary_latest.html) to check
how this endpoint works.
## Sample
A sample node is attached to this package to illustrate the steps described in
the previous section. It's a simple node that converts a Celcius temperature
measure into Kelvin.
### How to build
Build the docker image:
```sh
cd sample_node
docker build -t <your dockerHub username>/kelvin .
```
Publish it on your DockerHub:
```sh
docker push <your dockerHub username>/kelvin
```
Acquire a Dojot's token:
```sh
curl -X POST http://127.0.0.1:8000/auth \
-H 'Content-Type:application/json' \
-d '{"username": "admin", "passwd" : "admin"}'
```
This command will return a JWT token, you need to store it on an environment
variable:
```sh
export JWT=<the value returned>
```
Add the Kelvin node to Dojot.
```sh
curl -H "Authorization: Bearer ${JWT}" http://localhost:8000/flows/v1/node -H 'content-type: application/json' -d '{"image": "<your dockerHub username>/kelvin:latest", "id":"kelvin"}'
```
Now the Kelvin node will be available on `converters` category into the FlowBroker Dojot's interface.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size dojot_flow_node-0.0.10-py2-none-any.whl (6.0 kB) | File type Wheel | Python version py2 | Upload date | Hashes View |
Filename, size dojot_flow_node-0.0.10-py3-none-any.whl (6.0 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size dojot-flow-node-0.0.10.tar.gz (3.8 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for dojot_flow_node-0.0.10-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db0877cecc198d59400f5886edda6e9d38d32e2563a1e7d4da2f904a024217c0 |
|
MD5 | 9a999a9d6698a0445d3f993df18b13a9 |
|
BLAKE2-256 | 6469ffcc3f9192166f7541d462ad54a5fbd9a46235cbd10592cf5df5c1d262f4 |
Close
Hashes for dojot_flow_node-0.0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f07bb82b5d606909d3ae7e48bae1224c2f3585490bb8ba5ed503fcd897af03d2 |
|
MD5 | 40d5de43dd057c7bd6eedc925b303e71 |
|
BLAKE2-256 | 9ae9089556dbcfdaf08a4844181d3a4c293a482950e66826ee73ad9639dac6b6 |