Moreover, could your please also clarify the process in details about SubscriptionItems in EWSClient of consuming data from SBO, both for value and updated alarms? And it should also include how to renewal the subscription once expired or stopped for some reason.
I am expecting to it to make sure the way I am using is exactly correct.
The concept of an EwsSubscriptionItem is specific to native SmartConnector EWS Servers and unrelated to the EwsClient which is server agnostic and only concerns itself with the EWS Specification (found here SmartConnector Server).
An EwsSubscriptionItem represents an item (ValueItem, AlarmItem, HistoryItem, or SystemEvent) which is being subscribed to.
SmartConnector EWS Server subscriptions support ValueItem events (Value and/or State changes), HistoryItem changes, AlarmItem changes, and any data item hierarchy changes (think of this a an item being re-parented). Since SmartConnector EWS Servers do not support SystemEvents, those subscriptions are also not supported.
SBO only support ValueItem events.
While different EWS Servers may handle this differently, it should be assumed that an expired subscription can NOT be renewed. Rather, you would need to create a new subscription. In general, a non-expired subscription can be renewed at any time for the duration requested. (NOTE, SBO always sets subscriptions and renewals at 30 minutes.)
In Mongoose.Process.Ews there is a class call SubscriptionReader. This class will take care of the subscription creation and reading and it will also automatically renew when needed. You just need to pass in either a list of ews ids to create a subscription or a subscription ID and then call ReadData on the reader to get the values.
Mark, does the documentation have more information on this reader?
SubscriptionReader is listed in section 4.1 of the SmartConnectoer Developers Guide.
Thanks Mark,Jeff, now I know I was using SubscriptionReader as the way it be.
And in order to long term maintain a subscription progress to SBO, normally I check the status of a subscription, if current subscription failed and I just create new one as:
However, from the log(as I output the subscription ID into log file), I found frequently, new subscription will be created, which means old subscription failed, could you please help list all possible reasons which may cause a subscription fail so that I can better trace to refine the progress?
You asked "could you please help list all possible reasons which may cause a subscription fail so that I can better trace to refine the progress"?
That's not really a SmartConnector question. The underlying server (what is actually serving up the data to SmartConnector) is the system that determines how, when, or if a Subscription is no longer valid. For example, if you are using the SoapEwsRestProvider and the "Server Address" you configure is an SBO ES or AS EWS endpoint, then that is where you would need to direct that question too.
Unfortunately, I'm not familiar enough with all of the reasons why SBO might invalidate an EWS Subscription. Perhaps others can add to this thread if they have information.
In the SmartConnector portal, if you set Logging to Trace (in Setup >> Settings). Also also turn on the EwsClient logging (set EwsClient to True in Setup > Logging Filters). Then you should be able to see the EWS requests that SmartConnector is sending from the SubscriptionReader and the responses from the SBO. The responses should give you a much better idea why these subscriptions are failing.
Feel free to attach a log if you need to some help deciphering it.
Thanks Jeff, I have followed your advice to turn on the EWSClient logging, my extension has been running for around 3 days and only one subscription is there so far.I will keep it running to see what happen if anytime new subscription was created automatically.