To specify a subscription on the DataChange event in your example, you would want to do the following:
On the class, specify the following annotation (or similar):
@ThingworxSubscriptions(subscriptions = {
@ThingworxSubscription(eventName = "DataChange", sourceProperty="myProp", enabled=true, handler="SubscriptionHandler")
})
Then within your template or shape you will want to define the SubscriptionHandler service:
@ThingworxServiceDefinition(name="SubscriptionHandler", isPrivate=true)
public void SubscriptionHandler(
@ThingworxServiceParameter(name="eventData", baseType="INFOTABLE", aspects = {"datashape:DataChangeEvent"}) InfoTable eventData,
@ThingworxServiceParameter(name="eventName", baseType="STRING") String eventName,
@ThingworxServiceParameter(name="eventTime", baseType="DATETIME") DateTime eventTime,
@ThingworxServiceParameter(name="source", baseType="STRING") String source,
@ThingworxServiceParameter(name="sourceProperty", baseType="STRING") String sourceProperty)
You should name the service something more useful than just SubscriptionHandler, I just used that as an example.
We're hoping to improve the documentation surrounding extension development in the next few releases, so hopefully some of these mysteries will be a little less mysterious.