Add Bridge to Job Spec

The bridge is another task, which takes control of the external adapter and performs the defined requirements, and gives back the results to the task services.

For instance, this job spec has a set of tasks

  • Temperature

  • copy

  • multiply

  • ethuin256

  • EthTx

For most of the job specs, we get the Multiply, ethUin256 & etHTX in place. But the other two (temperate, copy) will be changed from job to job.

In this example, the task is to call the bridge which is Temperature, then the temperature will in turn call the server (which runs external-adapter in http://localhost:5000/ endpoint) and bring the results.

The next task, will copy the data from the payload and send it to the next task which is "multiply".

Multiply and then remove the fractions by multiplying with the value given in the contract and the ethuin256 task will convert the results into blockchain understandable format.

Finally, the ethTx task will write the data onto the blockchain.

{
   "initiators": [{
	"type": "external",
	"params": {
		"name": "xdc",
		"body": {
			"endpoint": "xdc",
			"addresses": ["0x88b1718fa0C01459e0A6a42Ec9AFdB299613d30F"]
			}
	}
     }],
     "tasks": 
         [   {
	     "type": "Temperature"
	     },
	     {
	     "type": "copy",
		 "params": {
		    "copyPath": [
			"result"
				]
		 }
	     },
	     {
		"type": "multiply"
	     },
	     {
		"type": "ethuint256"
	     },
	     {
		"type": "EthTx"
	     }
	 ]
 }

Similarly, the bridge can perform any task and bring value to the prescribed format.

Implementing an external adapter - custom logic is with the user.

Last updated