thingsboard / thingsboard-edge

Apache License 2.0
104 stars 77 forks source link

Can I send a persistent RPC via the TB Edge HTTP API? #123

Closed dratasich closed 2 months ago

dratasich commented 2 months ago

Component

Description Can I send persistent RPCs to the Edge?

###
POST {{host}}/api/rpc/oneway/{{rpb_device_id}} HTTP/1.1
Content-Type: application/json
X-Authorization: Bearer {{auth_token}}

{
  "method": "MyMethod",
  "params": {
    "test": "twoway persistent RPC",
    "file": "test.http"
  },
  "additionalInfo": {
    "extra": "test"
  },
  "retries": 3,
  "persistent": true
}

Where {{host}} is either the TB URL or the edge URL:

I used the default root rule chains where the RPC call request node receives a RPC_CALL_FROM_SERVER_TO_DEVICE. The screenshots above are from these nodes (TB vs. edge respectively)

Environment

Thanks in advance! Kind regards, Denise

dratasich commented 2 months ago

OK, sry, on another edge instance it works (I get 200 and rpcId) ... seems like I have broken the Rule Chains somehow. Or it has something to do with the setup.

dratasich commented 2 months ago

The problem was that the device was created in the main instance. As soon as I created the device in the edge (as it is meant to be in my use case), the call works as expected. My learning: the RPCs are meant to be processed in the instance where the device has been created (regardless of the device's assignment to the edge(?)).

AndriiLandiak commented 2 months ago

Hi, @dratasich!

Thanks for the request. Unfortunately, there is an issue with persistence RPC. The message is always identified as persistence=false. We could provide a hotfix image for both PE and EDGE-PE, could you send me an email - alandiak@thingsboard.io and I'll provide you details?

dratasich commented 2 months ago

Hi @AndriiLandiak, ah, this issue of persistence=false is when sending an RPC request in the rule chain (?) - I have a workaround for that. For now, there is no hotfix image necessary. Thanks!