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.
- Forum
- Discussions
- QuickOPC-UA in .NET
- Connections, Reconnections, Certificates
- Correct way of handling easyUAClient.MonitoredItemChanged
Correct way of handling easyUAClient.MonitoredItemChanged
Please Log in or Create an account to join the conversation.
I have implemented the Queue for the Write and updated the program on the customers machines and almost all errors disappeared!
You should add an example that shows how to use Write within a Subscription event handler!
Thank you very much for all you help!
Please Log in or Create an account to join the conversation.
I have also checked with our PLC guy and he doesn't care in which order the values are set.
So I'm going with QueueUserWorkItem
Thanks!
Please Log in or Create an account to join the conversation.
On the same EasyAUClient, you will not receive a new MonitoredItemChanged event until you finished handling the previous one.
But be aware that with QueueUserWorkItem , even with knowing the above statement, on itself won't guarantee the same order of execution. You would have to wait for completion of the work inside the event handler, in order to get a guaranteed order. That's why maybe an approach like with ConcurrentQueue might be better.
Please Log in or Create an account to join the conversation.
I have a follow up question.
I'm guessing that the event MonitoredItemChanged can be triggered multiple times without the event hander OPCClient_MonitoredItemChanged has finished its work?
That may be a problem since the QueueUserWorkItem doesn't guarantee in which order the tasks will perform.
For each change the PLC writes, and is noticed by the subscription, I will write the same value back to the PLC.
I'm not sure how the PLC will handle if the response are not in the same order as the what it has written. I will off cause check with the PLC guy...
But my question is: Will I get a new MonitoredItemChanged event before the OPCClient_MonitoredItemChanged function has finished?
Please Log in or Create an account to join the conversation.
OK, I will just have one client and use it both in subscription and in the QueueUserWorkItem callback function.
Thanks!
Please Log in or Create an account to join the conversation.
So I'd suggest to first implement the ThreadPool.QueueUserWorkItem .
Best regards
Please Log in or Create an account to join the conversation.
easyUAClient = new EasyUAClient { Isolated = true };
EasyUAClient.MonitoredItemChanged += OPCClient_MonitoredItemChanged;
easyUAClientWrite = new EasyUAClient { Isolated = true };
Is this needed or can I use the same client for the subscription and for the write in the queue?
Please Log in or Create an account to join the conversation.
Note that you have not described your issues therefore it' possible that they have other cause. But calling EasyXXClient methods form inside the event/callback handler should be avoided anyway, that's right.
Please Log in or Create an account to join the conversation.
It's the only Write part that should be put in the queue, not the saving of the value to a property?
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-UA in .NET
- Connections, Reconnections, Certificates
- Correct way of handling easyUAClient.MonitoredItemChanged