-
Notifications
You must be signed in to change notification settings - Fork 268
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
Node monitor (extended subscription) #252
Conversation
There are some naming/structure issues I'd still like to resolve. Possibly merge |
This looks like a good start. Maybe call it Do we have to support both channel and callback mechanisms? Wouldn't channel be enough? Also, you can add nodes as strings and You probably don't want to |
Thanks for the feedback. Regarding chan v callback, my favorite APIs are the ones that usually provide both. From this somewhat hyperbolic article: https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-should-feel-bad/
|
I should point out that the current callback implementation is actually less performant the the channel method because the callback code uses a channel behind the scenes. However, that could be removed with a little bit of work. |
@@ -196,6 +198,29 @@ func (s *Subscription) sendNotification(ctx context.Context, data *PublishNotifi | |||
|
|||
} | |||
|
|||
// Stats returns a diagnostic struct with metadata about the current subscription | |||
func (s *Subscription) Stats() (*ua.SubscriptionDiagnosticsDataType, error) { | |||
// TODO(kung-foo): once browsing feature is merged, attempt to get direct access to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this refer to the more browsing branch or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. though I haven't tried it on this exact use case. So it is possible that I can't get access to the single diag node. Also, I noticed that with the FreeOPCUA server, no diag nodes are generated. Is there a standard way to indicate that that feature is not supported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know.
@kung-foo are you using this code right now or are you planning on using it? |
Yes, we are using it, though not in production. |
How did you find the timer leak? |
re the timer leak: manual inspection. I just happen to remember that "idiosyncrasy" of the timer API. |
@kung-foo How far are we from merging this? I'd like to start using it. |
I think we are good to merge. We can re-visit features like reconnecting to a subscription in a future PR. |
Then lets do it. |
Thank you for creating the monitor code which i've been testing. I have a need to pass the msg.value.value() values data back to my own custom struct array I have in the main() routine for a series of NodeIDs. Can I do this by interrogating the subscription server? Or do I have to send the NodeIds data (time, value, quality, etc) via channel? |
This PR creates a new
NodeMonitor
struct for creating managed subscriptions. It attempts to hide implementation details from the user, and provide a simple, high-level interface for interacting with data change events.see related discussion: #240
The example code shows the two different methods for a subscription: callback-based, and channel-based.