Источник:
http://www.axstart.com/ax-3-0-and-4-...d-4-0-batching
==============
It is quite easy to create batch clients in Microsoft Dynamics AX old. It is getting harder when you want to check it easily if all batches are still running.
There are some additional Microsoft programs and functionalities in Microsoft Dynamics AX that can help you out:
- Start every batch client like a real server.
- Logon with a different user for every batch service.
- Place a dedicate AOS server on the batch server.
Missing code in Microsoft Dynamics AX
In the class SysStartupCmdBatchRun, method inforun is one line of code missing. Add this line so the batch service will use the correct batch group.
void infoRun()
{
BatchRun batchRun = new BatchRun();
;
batchRun.parmUseForm(true);
batchRun.parmGroupId(parm); //TODO Missing line
batchRun.run();
}Monitoring the Batch
- Logon with a different user for any batch client, so you can see with the task manager of Windows:
- Memory consumption
- If batch client is still running (the batch service is running in services but the batch client is gone
- With the online users form in Microsoft Dynamics AX, you can monitor if the batches are online.
How to run a single batch process that processes jobs for multiple companies
In Microsoft Dynamics AX 4.0, a batch process or a batch server can process jobs for only one company. However, a virtual company can access the batch table collection for other companies. When you add jobs to a batch group, Microsoft Dynamics AX 4.0 inserts the virtual company identifier in the
DataAreID field. When you run the batch process, the batch process treats all the records in the batch process as records from one company. Additionally, the batch process works as a central batch server.
When companies belong to a virtual company, you can create a batch group for a company that belongs to the virtual company. This batch group is then used by the other companies. This feature lets you run one batch process that processes jobs for multiple companies. To do this, follow these steps:
- In the Main menu dialog box, point to Administration, expand Setup, and then click Virtual company accounts.
- In the Virtual company accounts dialog box, press CTRL+N, and then type a company account name in the Company accounts field.
- Click the Company accounts tab. In the Remaining company account list, select companies for which you want to run the batch process, and then click the left-arrow button.
How to run a single batch process that processes jobs for multiple companies
In Microsoft Dynamics AX 4.0, a batch process or a batch server can process jobs for only one company. However, a virtual company can access the batch table collection for other companies. When you add jobs to a batch group, Microsoft Dynamics AX 4.0 inserts the virtual company identifier in the
DataAreID field. When you run the batch process, the batch process treats all the records in the batch process as records from one company. Additionally, the batch process works as a central batch server.
When companies belong to a virtual company, you can create a batch group for a company that belongs to the virtual company. This batch group is then used by the other companies. This feature lets you run one batch process that processes jobs for multiple companies. To do this, follow these steps:
- In the Main menu dialog box, point to Administration, expand Setup, and then click Virtual company accounts.
- In the Virtual company accounts dialog box, press CTRL+N, and then type a company account name in the Company accounts field.
- Click the Company accounts tab. In the Remaining company account list, select companies for which you want to run the batch process, and then click the left-arrow button.
- Click the Table collections tab. In the Remaining table collections list, select Batch, and then click the left-arrow button.
- Click Save, and then close the Virtual company accounts dialog box.
- Create a batch group.
- Restart Microsoft Dynamics AX 4.0.
- Run the batch process by using a company that belongs to the virtual company.
Create a real batch client service
Have a look at the Windows Server 2003 Resource Kit Tools
http://www.microsoft.com/en-us/downl....aspx?id=17657
This toolkit has the utility SRVANY.EXE; this tool can start any application in server mode. To create the service we use the program INSTSRV.EXE.
Example create service:
INSTSRV DynamicsBatch “C:\Program Files\Windows Resource Kits\Tools\srvany.exe” -a DOMAIN\batchuser1 -p Pa$$w0rd
Example remove service:
INSTSRV DynamicsBatch1 REMOVE
Next we have to add the Microsoft Dynamics AX batch client to the svrany service
Start Registry Editor.
- Select the following registry key : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DynamicsBatch
- With the above key selected, choose Add Key from the Edit menu.
- Enter “Parameters” (without the quotes) for the key name.
- Click the OK button to create this key.
- Select the Parameters key.
- Choose Add string Value from the Edit menu.
- Enter “Application” (without the quotes) for the value name and leave the data type at the default, REG_SZ.
- Click the OK button to create this value.
- In the String Editor window, enter the string value of “C:\Program Files\Microsoft Dynamics AX\40\Client\Bin\ax32.exe” (without the quotes),
- Click the OK button to add this string to the Application value.
- Select the Parameters key.
- Choose Add string Value from the Edit menu.
- Enter “AppParameters” (without the quotes) for the value name and leave the data type at the default, REG_SZ.
- Click the OK button to create this value.
- In the String Editor window, enter the string value of “-startupcmd=Batch_test” (without the quotes).
- Click the OK button to add this string to the AppParameters value.
Источник:
http://www.axstart.com/ax-3-0-and-4-...d-4-0-batching