Hello
I have a strange issue, with is partly covered in
viewtopic.php?f=23&t=8593
NAS is running a dispatcher codeunit. This codeunit is single instance and it runs a timer. On timer event, a codeunit is runned to check and proceed a queue.
This is the strange behavior: Timer starts to run. It imports a file, moves the file and writes to a log. The file name is the primary key for the log entry. File names are always unique, as the names are given by the source system. While the first event of Timer is still running, the timer seems to be triggered again, and it tries to import the same file again. The error message is "Record xy in Table xy already exists". Also strange: To avoid such a problem, the first statement on the Timer event is to disable that event, the last statement on the timer event is to enble it again.
I can reproduce the error when I run the dispatcher code unit from a client, so it's not a special NAS problem.
Anybody can imagine a possible problem?
Thanks in advance.
Thomas
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I have further investigated:
In the dispatcher codeunit there is a 2. timer. It seems, that the second timer stops the running functions of the first timer, but only if in the first function is using the smtp component of nav. This smtp component maybe causes the situation that the 2. timer event fires. Sounds a bit weird :? , but I had other issues with smtp and other automation controls that seemed to took the fokus a kind of away from nav for a moment. Taking the focus away for a moment causes for example form to refresh when focus is back, etc.
What do you think? Any contributions are welcome!
Thomas
RIS Plus, LLC
Yes, but quite complicated to change, heavy customized.
I made some tests with jMail, works like a charm and the licensing costs are moderate, probably cheaper than refactoring the dispatcher codeunits. Although it's not in a production environment yet, I'm optimistically to have solved/work around the problem.
Btw: Nav smt component imho has other gui-/threading-related problems. If C/AL Message statment is used while having the component instantiated, the client crashes in a way, that the keyboard does not work anymore in the current nav session and the fin.exe needs to be killed with task manager. That's the main reason I switched to a 3rd party component in that case.
Thomas
I usually have 3 folders:
Import (this is where new files are dropped)
Temp (this is where the files will be moved to when the processing starts)
Archive (this is where the files will be moved to after the import)
I also always create a file log table which holds the import/export status of files with an option field (Not yet processed, Import/Export started, Import/Export completed). If something goes wrong then I at least know the last status of the file and in which folder it currently is.
FD Consulting