web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Batch Jobs with a recurrence time of 20 seconds

(0) ShareShare
ReportReport
Posted on by

Hi all,
we want to use batch jobs in AX 2012 with a recurrence time of 20 seconds (in AX 4 this is implemented via an external app). Is it possible to customize AX to do that? Minimum in standard AX is 1 minute...
Or should we use the SysOperation framework?

Thanks in advance,
Frank

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at

    Hi Frank,

    I think it is possible to customize it. You can also try to setup 3 batch tasks having a recurrence of 1 minute and have the start time on e.g. 12:00:00, 12:00:20 and 12:00:40.

    There is no real guarantee that this remains on 20 seconds due to sometimes longer running tasks.

    To be able to provide a better answer, maybe you need to explain what exactly you are trying to achieve. For workflow processing, we are now considering having a direct scheduled task after finishing the previous one. Then it will run also almost continuously. This requires a customization and also some study to see if it impacts something else.

  • Community Member Profile Picture
    on at

    Hi Andre,

    in AX 4 we have some batch jobs which are running with an interval of 20 seconds - the jobs runs EVERY 20 seconds. So I think creating a batch task for every recurrence is not an option.

    Frank

  • Community Member Profile Picture
    on at

    Hi,

    we had the same problem. My collegue used a loop inside the run-method to meet the requirements.

    Maybe it's worth a try.

    Example for a 1-minute-recurrence:

        int iStartTime = timenow();
    
        while(true)
        {
            if(abs(timeNow() - iStartTime)> 60) 
            { 
               break; 
            }
            else
            {
                doSomething;
                sleep(1000);
            }
        }
    Regards
    Nils


  • Community Member Profile Picture
    on at

    Hi Nils,

    and you place your code in the RunBaseBatch-Class?

  • André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at

    Hi Frank,

    Like the comment in my previous reply: If you provide more details what you are trying to achieve, the question to use SysOperation framework or the Batch framework can be answered. Please elaborate on that.

  • Community Member Profile Picture
    on at

    Hi Andre,

    the batch job reads orders from a webshop and imports the orders into the ax system.

  • Verified answer
    Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    1-minute recurrence is supported out-of-the box, therefore no such code is needed. Also blocking the whole thread isn't a very efficient approach.

    For intervals shorter than one minute, you would have to modify the batch framework, especially BatchRun.serverProcessFinishedJobs().

  • Suggested answer
    Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    Regarding the information about webshop. First of all, think if you really need it so often and whether you'll be able to process the input in 20 seconds.

    Also, maybe you actually don't want to create a new batch every twenty seconds - maybe you want a single batch that will internally look into a queue and process the data (ASAP or in any interval).

    You could also use real-time communication, nevertheless the queue scales better.

  • Community Member Profile Picture
    on at

    Hi Martin,

    thanks for the information. I will take a look at BatchRun.serverProcessFinishedJobs and then check the second approach.

    Regarding the 20 seconds: This is not my decision...

    Frank

  • Suggested answer
    Srinath Sundaresan Profile Picture
    510 on at

    The feature to set the recurrence in seconds is not feasible out of the box. But the scheduled start time field in Batch job allows you to edit by seconds. This has to be edited manually. Also one thing to remember is that threads running the batch jobs have to be release before taking up your task. What you can think is to create batch tasks or batch jobs every 20 seconds. The spawning of new batches can be handled in a separate thread.

    But I am not so sure about the benefits you gain with 20 seconds compared to 1 minute execution with batch jobs. You can run into lock issues in tables.

    The choice of SysOperation framework or run base batch can be used for the batch job. But SysOpeartion should be the way going forward.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans