Hi,
When you make several dp subscriptions (to different dps) in a c# api manager, are the events of value changes are queued by the event manager, and sent to the api manager one by one?
In order to test it, I have created several subscriptions to different dps, and I realized that callback functions are not called asynchronously when a single api manager is used.
When I have multiple api managers (one for each subscription) callback functions are being executed in parallel, but I wonder if it is possible for a single api manager or not?
here is the code sample that I have made my test:
... creating the manager reading the config etc before.....
string dpNameConnect = "myTestDp.:_online.._value";
string dpNameConnect2 = "myTestDp2.:_online.._value";
var valueAccess = myManager.ProcessValues;
var mySubscription = valueAccess.CreateDpValueSubscription();
var mySubscription2 = valueAccess.CreateDpValueSubscription();
mySubscription.AddDp(dpNameConnect);
mySubscription2.AddDp(dpNameConnect2);
mySubscription.SingleValueChanged += workfunc;
mySubscription2.SingleValueChanged += workfunc2;
mySubscription.StartAsync();
mySubscription2.StartAsync();
private static void workfunc(object vcsender, OaSubscriptionSingleValueChangedEventArgs vce) {/* implementation here */}
private static void workfunc2(object vcsender, OaSubscriptionSingleValueChangedEventArgs vce) {/* implementation here */}
c# api manager - running callback functions in parallel on dp subscriptions
- Sabragan
- Posts:12
- Joined: Fri Feb 01, 2019 4:56 pm
c# api manager - running callback functions in parallel on dp subscriptions
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: c# api manager - running callback functions in parallel on dp subscriptions
If subscriptions (dpConnect) are made in WinCC OA the Event Manager sends the hotlink message to the manager when the subscribed value has changed. The Event Manager does not queue data for different subscriptions before sending the hotlinks.
You have to take into account that WinCC OA is not working multi-thread. In a manager only one thread can run at time. There can be several parallel threads but only once is processed in a moment.
Best Regards
Leopold Knipp
Senior Support Specialist
You have to take into account that WinCC OA is not working multi-thread. In a manager only one thread can run at time. There can be several parallel threads but only once is processed in a moment.
Best Regards
Leopold Knipp
Senior Support Specialist