Skip to main content
pshashipreetham
18-Opal
18-Opal
June 29, 2022
Solved

Subscriptions are not getting invoked, or delay in the Invoke

  • June 29, 2022
  • 1 reply
  • 5002 views

Hi,

There are subscriptions on EventAnyDataChange, but when ever there is any change in the Property the subscription are not getting invoked. There is no issue in logging the data in to the DB, that's working fine, but the subscriptions are not invoking.

Restarted the VM and also the TomCat.

@slangley , @PaiChung 

Thanks,
Shashi.

Best answer by pshashipreetham

Hi @VladimirRosu_116627 ,

Thanks for the reply, found the issue, this is due to Subscriptions are taking more time to execute.

As per below pic, there were more than 1000+ task awaiting to be executed, that's the reason the subscriptions are not invoking or invoking late. The Tasks are pending because, our DataTables have more than 20,000 entries, querying them and applying the filters is causing delay in execution of services present in the Subscriptions.

Shashi_Preetham_0-1657283095751.png


Purging the DataTable Entries and restarting the Thingworx fixed this issue.

Thanks,
Shashi.

1 reply

19-Tanzanite
June 30, 2022

I would doubt that the subscriptions do not start execution.

Can you offer a bit more specificity, like:

  • What ThingWorx version displays this?
  • what type of property exhibits this?
  • what is the DataChange value for that property definition?
  • modify the subscription code to write in the logs the start of the subscription, ie: first line: logger.warn("Subscription execution started for Thing"+me.name);

With the correct DataChange settings you should not have this issue.

pshashipreetham
18-Opal
18-Opal
June 30, 2022

Hi @VladimirRosu_116627 ,

Thanks for the reply,

  • Thingworx version: 9.3.2
  • Number/String DataType Property, PFA:
    psp316r_0-1656598619391.png
  • I did put the Logger on the first line of subscription for testing, that's how got to know the subscriptions are not invoking.

    Thanks,
    Shashi
19-Tanzanite
July 1, 2022

There are a couple of things which are not obvious when you try to execute subscriptions.

First, if a property value has a timestamp older than the current property value, the *DataChange events will not be triggered. Instead, the HistoricalPropertyLogged event will be triggered.

Second, if a new property value comes in the system, and has timestamp >= the current property timestamp, and has the same value, then the *DataChange events will not be triggered if the DataChange type is set to "Value".

Both topics above are the default behavior of ThingWorx, and they are documented in the Help Center.

 

I do not know which of the ones above apply to you, but I can give you a potential situation when that might happen: when you have a large batch of properties that are sent to ThingWorx (either via EMS or via REST, through UpdatePropertyValues), due to the parallel nature of the threads in the Event Subsystem, you might write in ThingWorx a value with a newer timestamp before you wrote the older properties in the DataSet.

The solution in the scenario I explained is just to use both events (*DataChange and HistoricalPropertyLogged) and point them to the same processing service.

 

While I'm very confident one of the above might be the case, or something relatively similar/default behavior,I do not know if this is really your situation.

In this situation, I think the investigation it is better suited for a Technical Support case (just to make sure we're not overlooking any other reasons which might really be bugs). Could you please open a case with Technical Support, meaning you do have access to our Support portal and can do that?