Add Bridge to Job Spec
Bridge is an another task, which takes the control to external-adapter and perform the defined requirements and give back the results to the task services..
For instance, this job spec has set of task
  • Temperature
  • copy
  • multiply
  • ethuin256
  • EthTx
For most of the job spec's, we ge the Multiply, ethUin256 & etHTX in place. But the other two(temperate, copy) will be changed job to job.
in this example, the task is to call the bridge which is Temperature, then temperature will in turn call the server(which runs exernal-adapter in http://localhost:5000/ endpoint) and bring the results.
Next task, will copy the data from the payload and send it to next task which is "multiply".
Multiply then remove the fractions by multiplying with the value given in the contract and ethuin256 task will convert the results into blockchain understandable format.
Finally, ethTx task will write the data onto blockchain.
1
{
2
"initiators": [{
3
"type": "external",
4
"params": {
5
"name": "xdc",
6
"body": {
7
"endpoint": "xdc",
8
"addresses": ["0x88b1718fa0C01459e0A6a42Ec9AFdB299613d30F"]
9
}
10
}
11
}],
12
"tasks":
13
[ {
14
"type": "Temperature"
15
},
16
{
17
"type": "copy",
18
"params": {
19
"copyPath": [
20
"result"
21
]
22
}
23
},
24
{
25
"type": "multiply"
26
},
27
{
28
"type": "ethuint256"
29
},
30
{
31
"type": "EthTx"
32
}
33
]
34
}
Copied!
Similarly, bridge can perform any tasks and bring the value to prescribed format. Implementing the external-adapter - custom logic is with user.
Copy link