Has anyone tried to use one NAS to start multiple single-instance codeunits? I want to try it, but I'm concerned because I don't know the threading model of Navision.
For example - if I use 1 NAS to start two single-instance codeunits to receive MSMQ messages - what happens if messages are received for both codeunits at the same time?
Also, and somewhat off-topic - why does each instance of the NAS cost 1600.00? If I read right, it's only a headless client... so why is the licensing structure like this, rather than simply a flat fee for use, and one client-license for each installed NAS?
0
Comments
I have not tried it, but AFAIK every instance of NAS is a single thread.
RIS Plus, LLC
MVP - Business Apps
[sarcasm]which is why I could effect the same thing by running the CodeUnit from a normal Navision Client. Wow... it all makes perfect sense now #-o [/sarcasm]
Once one receives a message, it starts processing it (=C/AL code). If in the meanwhile the C/AL is running to process the message of the first codeunit, another message arrives for the second codeunit, nothing happens. First the code of the first codeunit must finish and then the code of the second codeunit starts.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I had thought that this would be the case.
I was hoping there was someway to deliver a message failure back to the MSMQ if the system was already busy. Maybe I'll try tracking this one down.
I might post this as a product suggestion, too. Middle-tier solutions are usually multi-threaded, since they can be bombarded from multiple sources. They should really consider spawning a thread per single-instance codeunit that is started.
RIS Plus, LLC
MVP - Business Apps
Create one Single instance CU with timer, which increase global variable. Than create form, with a button. OnPush will start the CU and will do something for some time (e.g. for i:=1 to 10000 ...) After the work, read and show the value of the variable from the singleinstance CU. You will see, that the timer was counting during the for i:=1 to 1000... work. or, at least, was calling the OnTimer event and after the process ended, all the triggers were processed... :-)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
There are two buttons on the form - first will run the timer, do something (loop with reading the actual value from CU - still 0...). After the loop, the timer is stopped. When you press the second button, you will see, that there is some value (it is length of the loop in 0.1 second) - it means, all timer events vere fired after the first OnPush ended... :-)
(sorry for the used variable names and direct text constants, it is just example made in two minutes and it is not example of "how to write C/AL code"... 8) )
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Microsoft Dynamics NAV Developer
I've worked with a program before, however, that used multiple message queues. The way it had been designed, if a message arrived while another one (from another queue) was being processed, processing would immediately switch to the handler for the new message.
I need to make sure that Navision can handle the events for multiple message arrivals on different queues - that's why I'm asking about the threading model.
RIS Plus, LLC
MVP - Business Apps
I would attempt a test by writing a single-instance codeunit which writes a record with a datetime upon receipt of a message in the queue, then would wait 10 seconds, and finally write again with the current datetime (thereby ending the codeunit). I would make sure a COMMIT exists in after writing the first record, but before the 10 second delay (releasing the table lock). I would copy this code to another single-instance codeunit and modify it to read a separate message queue. Then I would create a routine that will write a message to one queue and then another (as simultaneous as I can get it to occur).
I would then run my NAS, which should load both single-instance codeunits, and fire my test messages out to both queues. If the first records written to my test table from each codeunit were 10 seconds apart, then we know NAS only handles a single thread. If they are written to the table within milliseconds from each other, we know NAS is able to multi-thread.
Microsoft Dynamics NAV Developer
2) As you can see in my example, the timer is not suspended, but all triggers are triggered at first occasion after process ends.
3) Nav is not multithreaded. There will be never two processes running in one time. Do not forget that it is still just NAV client without GUI. You cannot run two processes in NAV client (opened form or report is not process!).
4) You will be never able to process two queues in one time. It will process the queues on FIFP (first in, first processed ;-)) bases...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.