cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How do I get Stream Thing in java server side extension?

ahawaldar
1-Newbie

How do I get Stream Thing in java server side extension?

Hi Team,

I need to execute one of the service i.e. QueryStreamData in one of the custom service developed using java extension. One strange thing i found out was

DataShape datashape = (DataShape) EntityUtilities.findEntity("HighestFrequencyComponentDataShape", ThingworxRelationshipTypes.DataShape); ==> This works since there is a datashap with the same name provided in above statement.

However,

StreamThing frequencyComponentStream = (StreamThing) EntityUtilities.findEntity("frequencyComponentStream", ThingworxRelationshipTypes.Stream); ==> This returns me null though there is a Stream by name frequencyComponentStream in platform.


Can anyone tell me how can I get Stream in thignworx server side extension to execute QueryStreamData  service?


Thanks,

Azim


1 ACCEPTED SOLUTION

Accepted Solutions
ankigupta
5-Regular Member
(To:ahawaldar)

Hi azim hawaldar​,

Stream is type of Thing. Please try following:

StreamThing frequencyComponentStream = (StreamThing) EntityUtilities.findEntity("frequencyComponentStream", ThingworxRelationshipTypes.Thing);

I hope it helps.

View solution in original post

2 REPLIES 2
ankigupta
5-Regular Member
(To:ahawaldar)

Hi azim hawaldar​,

Stream is type of Thing. Please try following:

StreamThing frequencyComponentStream = (StreamThing) EntityUtilities.findEntity("frequencyComponentStream", ThingworxRelationshipTypes.Thing);

I hope it helps.

Hi Ankit Gupta​,

The above answer is also one way of doing it. I did the the other way as below

Thing frequencyComponentThing = (Thing) EntityUtilities.findEntity("frequencyComponentStream", ThingworxRelationshipTypes.Thing);

StreamThing frequencyComponentStream = (StreamThing) frequencyComponentThing;

Thanks,

Azim

Top Tags