would the following be helpful? I got this from a team member
this is from the C sdk I think
There is a “twApi_RegisterBindEventCallback” callback that can be registered for bound and unbound workflows.
* \brief Registers a function to be called when an entity is bound or unbound
* (see callback function signature bindEvent_cb()).
* \param[in] entityName Callbacks are filtered to the specified
* entity. A NULL value receives all callbacks.
* \param[in] cb The function to be called.
* \param[in] userdata An opaque pointer that is passed into the
* callback function.
* \return #TW_OK if successful, positive integral on error code (see
* twErrors.h) if an error was encountered.
int twApi_RegisterBindEventCallback(char * entityName, bindEvent_cb cb, void * userdata);
I don't see this API in the java SDK. It also occurred to me that a virtual thing could already be created for the remote thing and so I wouldn't see the callback.
The issue I'm facing is that remote thing property values are not seen in the virtual thing on the platform. In our system, remote things are bound in the edge before the corresponding virtual things are created. Once the remote things are bound, the property values are cached in the SDK and values of properties that don't change often are not seen in the virtual thing once it is created. I know we can change the property attributes to always push but that doesn't seem like an appropriate way to address this issue.
I'm looking for a way to determine IF a remote thing has a virtual thing for it on the platform. If it does not, I will delay setting properties for the remote thing via the SDK. An alternative to this would be to flush the SDK cache for the bound remote thing properties once a virtual thing has been defined for the remote thing. Both of these options require determining if a remote thing has a corresponding virtual thing.
This looks like it would allow us to do just what we want to do! Thanks for the pointer!
If it works, we'll mark it as the solution.
We addressed this problem by implementing a Thing service and calling the service from our connected client each time a remote thing new to the connected client instance shows up. The code from this post: Creating a Thing from a Virtual Thing Service (Java SDK) was leveraged for our purposes.