Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscribe example #32

Open
axlev opened this issue Apr 7, 2020 · 3 comments
Open

Subscribe example #32

axlev opened this issue Apr 7, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@axlev
Copy link

axlev commented Apr 7, 2020

Hello,
I have successfully browsed server for tags, and read their content. Great software and guidelines provided - thanks for that.

I am required to subscribe to be notified when a group of items was changed. Can you please refer me to a relevant example ? I am reading the OPC specification, but in go-ole package only reference I was able to find is calling a method and accessing a property.
How to get an event ?
Thanks for your support!
Alex

@konimarti
Copy link
Owner

@alexlev2004 Thanks. A while ago, I looked quickly into the subscription model as well and made the same observations as you did: the bottleneck seems to be go-ole.

You can, however, emulate the subscription functionality pretty easily in golang by implementing an observer design pattern. Please look at the flow package that I wrote for exactly these use cases (it implements an observer at its core). You could create a simple work flow and use the "on change" filter of the flow package, for example. Hope this helps.

@axlev
Copy link
Author

axlev commented Apr 7, 2020

Thanks for prompt answer.

@alexlev2004 Thanks. A while ago, I looked quickly into the subscription model as well and made the same observations as you did: the bottleneck seems to be go-ole.

You can, however, emulate the subscription functionality pretty easily in golang by implementing an observer design pattern. Please look at the flow package that I wrote for exactly these use cases (it implements an observer at its core). You could create a simple work flow and use the "on change" filter of the flow package, for example. Hope this helps.

Thanks for ptompt answer. The reason for subscribe model is to reduce OPC DA server networking and CPU. As far as I understood your suggestion emulates subscribe model on client side.
How would it possible to achieve - enhancing go-ole or can you see any additional options?
Thanks again
Alex

@konimarti
Copy link
Owner

Yes. Enhancing go-ole would be the place to start. And correct, the proposed solution emulates the subscriber on the client side which is admittedly a less elegant solution. However, in our use cases with thousands of tags and reading frequency in seconds, we don't really see a bottleneck in the network or CPU usage.

@konimarti konimarti added the enhancement New feature or request label Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants