Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Reactive subscriptions and multiple items

More
04 Aug 2014 10:24 #2126 by support
I understand what you want. We have thought about possible designs of supporting this, but because none of them look "beautiful" enough, we ended up doing none, at least for now.

We could let the developer create/subscribe observables individually, and somehow "group them" behind the scenes, for the optimization purposes. This can have two further sub-cases:

a) The grouping would be automatic. We will monitor what is being done, and make the bulk subscriptions based on criteria such as when enough time has elapsed, or certain number of observable has been issued. The issue with this is we have something similar in OPC-DA request handling, and the developers are commonly unhappy with somewhat undeterministic and "unpredictable" behavior this approach has.

b) The grouping would be manual - some kind of API methods to indicate "start" and "stop" of making subscriptions. This is of course possible to do but does not fill well with the common Rx usage pattern, and indeed common developer expectation either.

Note that there is a similar, if not worse, issue with un-subscribing - as that is tied to Dispose(), and if the developer is not doing it explicitly, it would be the finalizer who does it, with even less control from the developer.

Note that having an API that would allow to create multiple observables at once is not a solution - not only the API would not look nice, but it is not the creation of the observables that causes the issue, it is the Subscription being called o n them later.

So, how is it working now, and what are your options?

The methods I have seen in your posts so far are creating one observable per monitored item, and the calls that set up the UA subscription will indeed be done one by done, which is not very effective. Note however that if they use the same monitoring/subscriptions parameters, they will be merged into a single OPC subscription, therefore once they are subscribed, the server will handle them together - the ineffectiveness is only during the set-up (and tear-down) time, not during the duration of the subscription.

If you determine that the ineffectiveness causes a real problem, and is not just something being afraid of, the workaround might be:

- Use an overload of the Create static method that takes IEnumerable<UAMonitoredItemArguments> as an argument, and thus subscribe to multiple monitored items at once (not quite what you asked for, but at least it will not result in one-by-one subscription calls to the OPC server).

- You will receive an observable that gets notifications for all the items included in its creation call. It should be relatively easy, though, to create a computational-only observable class or a subject that would split the incoming events into separate observables, based either on the node Ids and other identifying pieces of info that come with the notification, or bases on the State object which you can pass in when creating the subscription or observable.


If you have a proposal of how this can be done differently or better, we would be interested in hearing that.

Best regards

Please Log in or Create an account to join the conversation.

More
31 Jul 2014 10:35 #2115 by giles
I am curious as to how Reactive subscriptions work with multiple items.

In the "standard" way of doing things you can group together lots of monitored items and subscribe to them all at once.

Ideally I'd like to subscribe to lots of observables individually but for your library to be working behind the scenes to send out subscriptions all grouped together to the OPC server if I very quickly make lots of individual subscriptions.

Does your code do this or will those subscriptions result in lots of individual messages going to the server?

I am using OPC UA btw.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.043 seconds