The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
Hi,
I am able to create a value stream object using the service CreateThing under Resource - EntityServices :
connectedClient.invokeService(RelationshipTypes.ThingworxEntityTypes.Things, "SampleValueStream", "CreateThing, vc, 5000);
and vc object contains the thingtemplate = "ValueStream".
Now I need to assign the PersistanceProvider to this value stream and also add the properties it will hold the data of. I can see the services listed in Thingworx composer UI - SetPersistenceProvider, AddPropertyDefinitions which can be used for these functionalities.
But I do not see the entity type ValueStream available in class 'RelationshipTypes.java' for accessing the services via connectedThingClient's invokeService() api.
Can anyone please help me how to specify the entityType and access these services via invokeService() api?
Regards,
Vaishnavee
Solved! Go to Solution.
Did you execute a RestartThing on the ValueStream after you created it?
Don't think I can help you through this completely, but a ValueStream is still considered a Thing I believe in what you are doing.
It should have a configuration table that specifies the persistence provider.
My other question would be, what prevents you from building this service in Thingworx and just invoking that service from your Edge? That should make it a lot easier to create.
Hi @PaiChung , you are right, I tried to create the ValueStream using the Thing service CreateThing. I too thought that the other services on this valuestream object would work the same way, but when tried to execute the following api call, it gives error 'service not available' :
connectedThingClient.invokeService(Things, "SampleValueStream", "SetPersistentProvider", vc, 5000);
The same response is received for other basic services like GetMetadata, GetDescription etc. And this led me to believe that we might be needed to specify the correct entityType in the first argument to the above call. I see the valueStream in class RelationshipTypes under the enum ThingworxRelationshipTypes but not under the enum for Thingworx Entities.
For the second point that you mentioned, I am reluctant to create any custom object on the end system of the input ThingWorx server (we might not have control to clean up the same before loosing the control of the server). But yes, if nothing else works, I can try this approach. Thanks!
P.S. : By custom object, I am referring to an object of which the end user has no knowledge of. The name of the valueStream is a direct input from the user and VS is created as a direct action by the user.
Regards,
Vaishnavee
Did you execute a RestartThing on the ValueStream after you created it?
@PaiChung You were absolutely right - ValueStreams are treated as Things in my context. All the steps used to create a Thing, enable & restart, add properties worked for value streams too. Thank you!