17:59, EET
October 21, 2014
In order to subscribe to multiple items the client sdk documentation says “You can add a notification listener either to the subscription or to each item (above). The latter will provide you more detailed information on the data changes, but creating the listener to the subscription can be easier to use and more light-weight. The SampleConsoleClient demonstrates both, but uses mainly the item based listener.”
I am unable to see corresponding listener code in the sample. Is it that the same listener will be triggered for any item change in the subscription of multiple items? Willl it not be inefficient that way if all items change every specified minimum interval? All items will be sent one by one to the listener?` Will a read on group of items from client not be efficient instead of subscription if all values change every cycle?
Some clarification will be appreciated?
PRAMANJ
4:03, EET
October 21, 2014
pramanj said
In order to subscribe to multiple items the client sdk documentation says “You can add a notification listener either to the subscription or to each item (above). The latter will provide you more detailed information on the data changes, but creating the listener to the subscription can be easier to use and more light-weight. The SampleConsoleClient demonstrates both, but uses mainly the item based listener.”
I am unable to see corresponding listener code in the sample. Is it that the same listener will be triggered for any item change in the subscription of multiple items? Willl it not be inefficient that way if all items change every specified minimum interval? All items will be sent one by one to the listener?` Will a read on group of items from client not be efficient instead of subscription if all values change every cycle?
Some clarification will be appreciated?
PRAMANJ
In other words, how to create listener to subscription rather than to individual items?
regards
PRAMANJ
4:25, EET
October 21, 2014
pramanj said
pramanj said
In order to subscribe to multiple items the client sdk documentation says “You can add a notification listener either to the subscription or to each item (above). The latter will provide you more detailed information on the data changes, but creating the listener to the subscription can be easier to use and more light-weight. The SampleConsoleClient demonstrates both, but uses mainly the item based listener.”
I am unable to see corresponding listener code in the sample. Is it that the same listener will be triggered for any item change in the subscription of multiple items? Willl it not be inefficient that way if all items change every specified minimum interval? All items will be sent one by one to the listener?` Will a read on group of items from client not be efficient instead of subscription if all values change every cycle?
Some clarification will be appreciated?
PRAMANJ
In other words, how to create listener to subscription rather than to individual items?
regards
PRAMANJ
Got it , its subscriptionListener that I have to see. Pl ignore my previous message.
regards
PRAMANJ
8:23, EET
October 21, 2014
Few clarifications on subscriptions:
1. Should be one listener for every subscription, or there can be same listener for multiple subscriptions as well?
2. What is the purpose of grouping items in multiple subscription apart from the possibility of logical grouping based on screens etc and possibility of having separate update cycle time for each subscription ?
3 If update cycle is same for all items then can we have just one subscription?
3. Can items repeat in different subscriptions?
3. Is it possible to enable / disable (stop/start) individual subscriptions?
4. the sampleconsoleclient application doesn’t seem to implement multiple item subscriptions right? It supports only single item subscription right?
regards
PRAMANJ
9:18, EET
April 17, 2013
Hello,
Should be one listener for every subscription, or there can be same listener for multiple subscriptions as well?
It’s flexible. There can be one listener for all subscriptions, or every subscription can have its own. And actually one subscription can have multiple listeners.
What is the purpose of grouping items in multiple subscription apart from the possibility of logical grouping based on screens etc and possibility of having separate update cycle time for each subscription ?
Those two are the main reasons.
If update cycle is same for all items then can we have just one subscription?
Yes. All MonitoredItems in the same subscription share the publishing interval of that subscription. However, the MonitoredItems can have different SamplingIntervals.
Can items repeat in different subscriptions?
Yes, they can.
Is it possible to enable / disable (stop/start) individual subscriptions?
Yes, see methods Subscription.setPublishingEnabled and Subscription.setMonitoringMode
the sampleconsoleclient application doesn’t seem to implement multiple item subscriptions right? It supports only single item subscription right?
Actually, SampleConsoleClient creates a single subscription and adds multiple MonitoredItems in this one subscription. See method subscribe in SampleConsoleClient for more details. You can test this functionality by running SampleConsoleClient, creating a subscription, then pausing the subscription (press p). Now, browse to another node and subscribe to it.
10:04, EET
October 21, 2014
Thanks for the clear answers.
On the last point of sampleconsoleclient application, I could subscribe to one node only, I didn’tknow how to add multiple node subscriptions! In the class MySubscriptionNotificationListener, the OnDataChange is empty, so I thought its for us to implement it. Please correct me if I am wrong.
Regards
PRAMANJ
10:49, EET
April 17, 2013
12:32, EET
October 21, 2014
I added the same code as in MyMonitoredDataItemListener.onDataChange in the MySubscriptionNotificationListener.onDataChange method, which was empty. (basically print the value of changed data item on console). It triggers both onDataChange methods when a subscribed variable changes! So is the MySubscriptionNotificationListener redundent?
regards
PRAMANJ
13:37, EET
April 17, 2013
13:57, EET
October 21, 2014
18:08, EET
October 21, 2014
Some more clarifications:
1. If you add an already existing item to a subscription , what happens? Does it get ignored or added twice in the list?
2. To add a new item to a subscription, do we have to necessarily pause or suspend the subscription? What happens if we try to add an item to a subscription without pausing it?
3. In the sampleConsoleClient application, once we subscribe to an item, the menu displays only p for pause, i for change interval etc, we cannot do anything else like write/read an item value while in subscribe mode. Why so?
4. Once we pause the subscription, we cannot resume subscription without adding a new item to subscription! Suppose I want to resume subscription without adding new item in the subscription list, how do I do it?
regards
PRAMANJ
7:36, EET
April 17, 2013
1. In SampleConsoleClient, the existing item is ignored. If you just call
then the SDK will add the new item twice. However, in the SampleConsoleClient you can see an example of how to check if this subscription already contain this item before adding it. This is done with
2. You do not need to do anything special before adding a new item to a subscription. The pausing is functionality of SampleConsoleClient. It is made because the usage of command line application is easier this way. In SampleConsoleClient source, you will see that pausing means setting subscription.setPublishingEnabled(false).
3. SampleConsoleClient is meant to function as an example application presenting how to use the SDK. It is also intended to be used from command line. When subscriptions are enabled, there might be a lot of data being printed to the command line. Other command line prints and user input might be lost among these other lines.
4. Subscribe again to one of the items that you are already subscribed to. The new item will be ignored and you will see the subscription menu.
13:33, EET
October 21, 2014
Heikki Tahvanainen said
1. In SampleConsoleClient, the existing item is ignored. If you just call
sub.addItem(item);then the SDK will add the new item twice. However, in the SampleConsoleClient you can see an example of how to check if this subscription already contain this item before adding it. This is done with
sub.hasItem(nodeId, attributeId);2. You do not need to do anything special before adding a new item to a subscription. The pausing is functionality of SampleConsoleClient. It is made because the usage of command line application is easier this way. In SampleConsoleClient source, you will see that pausing means setting subscription.setPublishingEnabled(false).
3. SampleConsoleClient is meant to function as an example application presenting how to use the SDK. It is also intended to be used from command line. When subscriptions are enabled, there might be a lot of data being printed to the command line. Other command line prints and user input might be lost among these other lines.
4. Subscribe again to one of the items that you are already subscribed to. The new item will be ignored and you will see the subscription menu.
1. Ok got it. But if we add an item twice , will it generate two calls to listener functions? Of course it depends on the server how it will take care of this functionality.
2. Ok. I understand that pausing is done by setting “subscription.setPublishingEnabled(false) “, but I wanted to clarify if its OK if we add items in subscription list without pausing subscription. In the sample client application this is done after pausing so I got confused. But I guess its only to stops the prints on console from subscriptions to avoid mixup if Inputs and outputs.
3. As above, and its clear.
4. Ok got it. Its related to the above question only, but we have to necessarily select another (same) item to proceed in the sample application, but not mandatory to pause in our implementation.
Thanks a lot
Regards
PRAMANJ
14:53, EET
April 17, 2013
15:42, EET
October 21, 2014
Ok thanks for the clarification. But I don’t know the point behind accepting same item multiple times in the same subscription! That’s something for specification to state. Of course there is a way provided to prevent multiple item addition for us to ensure unique items only. Of course if same item is added multiple times the server will blindly generate events for both entries! Its doesn’t know or care if the item already exists!
regards
PRAMANJ
17:12, EET
October 21, 2014
Few more questions:
1. The subscription alive listener triggers every 20 seconds, but I don’t see where the timer is initialized! Is it a default value that cannot be changed?
2. The subscription ID’s and Item ID’s seem to keep incrementing evry time I run the client. Is there a way to reset the count to or when does it get reset? On restart of the UA server?
3. I observe that when we browse the server address space containing tags when the subscription is ON (client modified to to remove the pause during subscription) , then after displaying the items , all subscribed item values are displayed, when none of the values changed! Under what conditions does the server refresh all subscribed values to client? I can understand that when we first subscribe , the initial values are all refreshed, after that it should just send changed values.
regards
PRAMANJ
8:50, EET
April 17, 2013
Hello,
1. The alive count can be set with subscription.setMaxKeepAliveCount method. Default value is 20. This value, together with the publishing interval, defines the keep-alive interval.
2. There is no way for client application to reset the subscriptionIDs, they get reset when the server restarts.
3. When changing the subscriptions publishing enabled value from false to true, the values are indeed refreshed when using SampleConsoleServer. This logic is happening on the server side.
10:22, EET
October 21, 2014
Heikki Tahvanainen said
Hello,
1. The alive count can be set with subscription.setMaxKeepAliveCount method. Default value is 20. This value, together with the publishing interval, defines the keep-alive interval.
2. There is no way for client application to reset the subscriptionIDs, they get reset when the server restarts.
3. When changing the subscriptions publishing enabled value from false to true, the values are indeed refreshed when using SampleConsoleServer. This logic is happening on the server side.
Point 1 – thanks for the info. Changing alive count is not required by me, default 20 secs is fine. However there was a message continuously displayed that server is alive, which was distracting. I just commented it in the sample client code to silence it!
Point 2 – I also thought so.
Point 3 – makes sense! When one pauses subscription, its important that all subscription values are refreshed when we resume subscription! Well thought out implementation (or specification)!
Regards
PRAMANJ
5:39, EET
October 21, 2014
In the sampleConsoleApplication , if we subscribe to a node followed by “/*” then all nodes below this hierarchy are subscribed to. But if we have multiple folders below this folder, will all the nodes below it be subscribed recursively? I am lazy to create such as hierarchy and test.
How does the subscription work in client?
Regards
PRAMANJ
Most Users Ever Online: 1919
Currently Online:
16 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 729
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
PromotionToold, HypromeImpupe, toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachusModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1