Recently I was involved in a project were job queue processing was for a multi-company scenario. In this scenario various messages were exchanged between the headquarter, sales company and the manufacturing site. In this article I would like to zoom into the Sales / Manufacturing Intercompany EDI messages.
In both the Sales and Manufacturing Company a number of NAVBIS 2013 connections were configured. Both Companies were configured to use the Job Queue.
Each company is using the default Job Queues:
The NAS Service is configured for the Dynamics NAV Instance:
After starting the Dynamics NAV Server the following sessions are running:
As you see in the screenshot above, the number of active sessions is a more than you might expect. Especially if you compare this with the classic environment in which you just had one session for a company. But when you dig into the details it is not as strange as it seems.
Let’s start with a schematic view of the job queue elements:
NAS Service: this is the initial session which runs codeunit 450 in the company as specified in the NAS Services configuration of the Dynamics NAV Instance.
Background process for each Job Queue: the job queue does not have shared tables and is configured per company. The NAS Service will start a new background process for each Job Queue in the companies of the current database. In this case we have two job queues per company which results in 4 sessions to be started.
What happens if a job is executed? In order to test that we create a job queue entry which runs a nice codeunit which runs for a while.
Let’s checkout the session list again:
Please notice a new session has been started for this Job Queue Entry.
Let’s checkout the details of the Job Queue entry by going to About This Page:
As you can see the Job Queue Entry knows in which session it is processed which is nice.
Conclusions:
- Each Job Queue Entry is processed in a separate session which is closed automatically if the job has been completed.
- All sessions are running under the Dynamics NAV Service Account.
- It is possible to figure out which session runs which job queue and which job queue entry but it is not easy.
- Debugging sessions becomes more difficult as the number of sessions increases.