Skip to main content
1-Visitor
October 13, 2020
Solved

How to access Value stream objects' services via Thingworx edge sdk 8.5?

  • October 13, 2020
  • 1 reply
  • 2682 views

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

Best answer by PaiChung

Did you execute a RestartThing on the ValueStream after you created it?

1 reply

22-Sapphire I
October 13, 2020

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.

1-Visitor
October 13, 2020

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

PaiChung22-Sapphire IAnswer
22-Sapphire I
October 13, 2020

Did you execute a RestartThing on the ValueStream after you created it?