Job Queue for Unlimited Company
Comments
-
As I mentioned the startup parameter is used by 1st nas to start the second nas and pass parameter/company/record to process the job.
You shouldn't use it to start NAS.0 -
I think I confused here.
I have 2 NAS - HHG-SQL1 and HHG-SQL2.
In application server under console I define all the values in HHG-SQL1(Like Server, Database name, company and Startup parameter=JOBQUEUE2)
In Codeunit 1 I called CU50001. In 50001 under function I dfined second NAS configuration(Like server, Database, Company Name(From Job Queue Entry Card - "Company Name" field) and Startup Parameter=JOBQUEUE2|MASTER|JobqueueID.
Now When I am tryning to run First NAS from Application Srever, getting the error message CopySTR out of range.
What I am doing wrong here please advice. I am really confused.
Regards0 -
It looks like you did not follow the directions.
Do you have more than 2 companies? If you have just two companies then you don't need this modification.
Add the following to CU 1
END;
//MOD01 Start
IF (COPYSTR(Parameter,1,9) = 'JOBQUEUE2') THEN BEGIN
CU50000.SetParameter(Parameter);
CU50000.RUN;
CGNASStartedinLoop := TRUE;
END;
//MOD01 End
IF CGNASStartedinLoop = FALSE THEN
You also do not need to install two NAS Service just one.0 -
Yes I already written code in CU 1. I modifed all the objects downloaded from the link you specified.0
-
I disabled the second NAS but same error getting
Event Type: Warning
Event Source: GGHAPP01-SQL-2
Event Category: None
Event ID: 20010
Date: 8/27/2010
Time: 2:22:24 PM
User: N/A
Computer: GGHAPP01
Description:
The value of COPYSTR parameter 3 is outside of the permitted range.
The current value is: -1.
The permitted range is: from 0 to 2147483647.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.0 -
I didnot understand yet what I am doing wrong
. Run the first NAS from command prompt but same error getting
0 -
Check your PM.0
-
Hi,
Finally I can run 2 NAS for multiple companies. It was running fine since 2 days.No issues. Today one of my co-worker re-started NAS server and after that I am getting the isssue. The issue is CU5000 started the NAS and cmd command prompt, but it never be closed. cmd command prompt remian open unless I go manlly close the window and got the following message:
Windows cannot end this program.It may need more time to complete the operations.If you choose to end the program immediately you will loose unsaved data.
When close the window manully, NAS is not able to save any records in the table.( Called one code unit in JOBQueue which saves the records from the staging table to some other table). It won't do any process.
Windows cannot end this program.It may need more time to complete the operations.If you choose to end the program immediately you will loose unsaved data.
WSHExec.Terminate has been called in CU and when I message WSHExec.status, got the status=1 which means terminate but actully cmd prompt is not closed.
Please let me know if you have any idea.
Regards
Mini0 -
stop nas and make sure there are no nassql.exe running in the task manager. reboot the server.
The thing i would do is the start the job queue CU from nav client and monitor/ debug what is happening.
If you are in 2009 version you can use the job/queue webservice solution. If you are in 5.0 version you can do 2009 executalbes and use job/queue webservice solution0 -
Hi,
I am using 2009 classic. As i read ur postings regarding webservices running for multiple companies, seems like client have to purchase one license for web services. I am not sure at this stage if they will buy the license. They already bought NAS license. So I am just wondering in NAV2009 if 2 NAS will run for multiple compnies without using webservices or not.
As i mentioned in my earlier post that it was running fine for couple of days and now i am getting the problem that cmd prompt did not close and hence nothing will happen. However if i look in Job queue log entry no error has been reported and status is Success instead of Errro.
As u said that I stopped the NAS and also did endtask from Task Manager and reboot the NAS server, but did not get any luck. Do I need to reboot SQL server also?
Please let me know if you can find what could be the issue.
Regards
Mini0 -
Hi,
Any thought in my previous mail?
Regards
Mini0 -
Hello currently use your code: Job Queue for Unlimited Company but recurring errors that my client ask for them and I have not been able to explain what the origin of these.
Could you help me understand why there are these errors? are needed?
I Don’t understand this part: Why 10 milliseconds on idle time?
IF CURRENTDATETIME - StartDateTime > 10000 THEN BEGIN
Session2.SETRANGE("My Session",FALSE);
Session2.SETRANGE("User ID",Session."User ID");
Session2.SETRANGE("Database Name",Session."Database Name");
IF NOT GUIALLOWED THEN
Session2.SETRANGE("Application Name",Session."Application Name");
Session2.SETRANGE("Host Name",Session."Host Name");
IF NOT Session2.FINDFIRST THEN BEGIN
EXITNAS := TRUE;
Responseline := ' NAS JOB EXITED';
StandardError := TRUE;
WriteToArrayMsg(Responseline);
END ELSE
IF Session2."Idle Time" > 10 THEN BEGIN
EXITNAS := TRUE;
StandardError := TRUE;
Responseline := ' NAS JOB IDLE';
WriteToArrayMsg(Responseline);
END;
END;0 -
The first NAS return a SUCCESS message that it's finished if you have changed that code, then nav will look at the Timeout. Make sure the Child NAS puts a SUCCESS message out to tell the Parent NAS that it's finished processing.0
-
I discovered a bug in this modification: when you set up a Job Queue Entry to run where Company Name <> '' and Recurring Job = FALSE, the Job fails with the error that it doesn't exist.
This is because the Job Queue Entry is deleted before it is actually run by the second NAS instance that is run from Codeunit Run NAS Accross Company.
I have one Company where Job Queue is set up: Company A. And I set up a Job Queue Entry to run a Codeunit in Company B with Recurring Job = FALSE.
The following happens:
The "normal" NAS instance that is running with StartUpParameter JOBQUEUE executes Function NASHandler in Codeunit 1. From there it runs Codeunit 448 Job Queue Dispacher. There the Automation NavTimer is enabled and from there it executes Function HandleRequest. There the following code is run:
IF ThisSessionIsActive THEN
MoreRequests := GetNextRequest(JobQueueEntry); // locks table
WHILE ThisSessionIsActive AND MoreRequests DO BEGIN
JobLogEntryNo := InsertLogEntry(JobQueueEntry);
ThisSessionIsActive := UpdateJobQueueSession(JobQueueEntry,TRUE);
COMMIT;
WasSuccess := CODEUNIT.RUN(CODEUNIT::"Job Queue Start Codeunit",JobQueueEntry);
In Function GetNextRequest the next Job Queue Entry to run is found. After it has been found the the following code is executed:
IF Found THEN BEGIN
JobQueueEntry.CALCFIELDS(XML);
IF JobQueueEntry."Recurring Job" THEN BEGIN
JobQueueEntry."Earliest Start Date/Time" := CalcNextRunTime(JobQueueEntry);
JobQueueEntry.Status := JobQueueEntry.Status::"In Process";
JobQueueEntry.MODIFY;
END ELSE
JobQueueEntry.DELETE;
END;
EXIT(Found);
The non-Recurring Job has now been deleted but has not been committed to the database yet. But before the Job Queue Start Codeunit that actually runs the job is called a COMMIT statement is executed. Normally this is no problem because the Job Queue Entry Record still exists in memory but because this modification that runs NAS accross Companies starts a second NAS instance with StartUpParameter JOBQUEUE2 that has to run this job, it is a problem. The delete of the Non-Recurring Job Queue Entry Record is already committed and the Job fails because the second NAS instance can't find it anymore.
I applied the following two fixes to solve this problem:
Codeunit 448 Job Queue Dispatcher, Function GetNextRequest:
IF Found THEN BEGIN
JobQueueEntry.CALCFIELDS(XML);
IF JobQueueEntry."Recurring Job" THEN BEGIN
JobQueueEntry."Earliest Start Date/Time" := CalcNextRunTime(JobQueueEntry);
JobQueueEntry.Status := JobQueueEntry.Status::"In Process";
JobQueueEntry.MODIFY;
END ELSE
//Begin
//JobQueueEntry.DELETE;
IF JobQueueEntry."Company Name" = '' THEN
JobQueueEntry.DELETE;
//End
END;
EXIT(Found);
Codeunit 449 Job Queue Start Codeunit, Function OnRun:
//MOD01 START
IF "Company Name" <> '' THEN BEGIN
CLEAR(CduRunNASAccrossCompany);
CduRunNASAccrossCompany.RunNasForOtherCompany(Rec);
//Begin
IF NOT "Recurring Job" THEN
DELETE;
//End
END ELSE
//MOD01 END
Hope this helps somebody
Regards, Max0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions