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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Extension: Event Subscription

mbonelli1
1-Visitor

Extension: Event Subscription

Hello everyone!!!

I'm trying to figure out if it's possible for a Java extension to subscrive to an event which is defined on the ThingWorx IoT Platform. The Idea is that I have an Android app that sends data to the Platform. If somethings happens, for example the CPU Usage is too High I will trigger and event.

Is there any way I can subscrive to the event CPU Usage from my Java Extension so that when the envent occurs my extension automatically runs an handler??

Hope some of you will be able to help me with this!!!

Have a good day everyone!

5 REPLIES 5
qn
12-Amethyst
12-Amethyst
(To:mbonelli1)

Hi,

what do you mean by the Java extension ? Is that a ThingWorx component ?

mbonelli1
1-Visitor
(To:qn)

Hi,

what I was trying to say is that I wanna make a Java Application for PC that connects to the ThingWork IoT Platform using the Java ThingWorx SDK. The goal is that I want the java application to detect the events that occur on the platform automatically.

Is there any API that allows me to do that in the SDK? is it even possible to do something like this?

The only way I thought of doing it is to define a Virtual Thing in the Java App, define a service and on the Platform bind the Virtual Thing service to the event. I don't know if this is possible or if there is a simplier way to do this, maybe without defining a Virtual Thing.

Thanks for the answer, I really appreciate your help!

Ps. I found some documentation on the ThingWorx SDK APIs at the following link but it doesn't say much on what the APIs actually do. Is there any other place I can find more informations?

http://support.ptc.com/cs/help/thingworx_hc/thingworx_edge/

qn
12-Amethyst
12-Amethyst
(To:mbonelli1)

Did you see this thread: Extension : Thingworx Event Subscription

mbonelli1
1-Visitor
(To:qn)

Yes I saw it but I can't understand if using the annotations I can only subscribe to the events defined in the Virtual Thing or I can actually subscribe to any event, even the ones that are defined on the platform!

So there's two possible solutions here.  One, you could create a custom extension for Thingworx using the SDK.  This extension could define a new Thing that subscribes (either programmatically or using the annotations) to the events you're interested in on whatever things are on the server.  Since it triggers a service method whenever the event fires, you can give it any behavior you want once it receives the event.

Two, if you prefer the separate application solution, then use the Java SDK for Edge development instead.  It's pretty similar to how you describe in that you define a virtual thing to bind to, have it subscribe to events on the other things, and then have your app handle the events whenever it receives the payload data.

Announcements


Top Tags