I'm looking for a way to terminate a process which takes too much time to run ? Is there any way I can get this done ?
Let's take requesting to a webservice as an example: I expect one request should not exceed 3 minutes to get the result back. One would be marked as "Delay" if its request exceed the time limit.
I know we can solve this by limiting the request time, timeout time of service. But I'm looking for a more generic way, so it will help for another tasks as well.
Thanks for reading
Answers
- on the client side in the case of async. call -> set yourwsclient.Timeout parameter,
- on the server side -> setting of the OperationTimeout of your web service CustomSettings.config file.
Like I said before, we can control it by setting the timeout in webservice setting. I'm thinking about another process like reading file, loading file, any process that can take long time to run. Like reading file, we can't config it externally. So thinking about navision, can we do this programmatically ?
Anyway, if you know what session your process is you can terminate it from another one if you need it. You can control it by the NAV code of course. Moreover when you run specific function as WS method you can control processing time inside NAV directly within the process itself...
All of this depends what exactly do you need... You should describe better your requirements to understand all details of your wishes
It's great that I have someone follow my question this long since I don't describe my question clear and understandable enough. But due to your answer, The purpose of terminating it is time and performance is what I concern at the moment. Like I expect it to run in 3 minutes, even if it runs well in 5 minutes, it doesn't pass. And I also mark it as "Delaying", so later when I take a look at the process management, I can find out "Ah ha! This one is slow. Let's check why it is?" An example code for this one is more than great to me. I learn better through examples
Thanks for reading.
In each process, when something is long, it means that there is loop, whcih should end after some time. This you can check inside the loop. You cannot do that only if you are calling external function which is atomic for you and it itself take too long.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Just like kine said... Except the situation that the atomic function can be executed asynchronously (in this case usually a callback is provided) and you have some method to abort it.
Thanks you and kine for great answer and explanation. Thinking about aborting atomic funciton in nav, I think it's not possible at the moment and use case is rare. I will mark this as solved