How to Invoke a LiveCycle Process Periodically

There are some cases where there’s a need to invoke an orchestration or a service periodically. There are a few ways to accomplish that:

• Use a cron expression
• Use the Windows Task Scheduler
• Create an orchestration with a timer

With the first two options, you need to build a script or an executable to be called by the cron job or the Task Scheduler.

In this post, I’ll focus on the third option which is to creating an orchestration.

LiveCycle Process Management provides a service that suspends the execution of a long lived process for a period of time. This service is called the Wait service and is located within the Process Management category.

The service is pretty straight forward to use. You just specify the amount of time you want to wait before going to the next step. The next step can be another service call or a sub process. If you want to periodically call that next step, you can always loop back to the wait.

Now, in order to start the loop, we need to invoke the process once. If the server is restarted, the process will still continue the loop when LiveCycle is up and running again since it’s long lived.

Jasmin

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 0.0/10 (0 votes cast)
This entry was posted in Adobe LiveCycle ES2 (9.0.x) and tagged , , , , , . Bookmark the permalink.

10 Responses to How to Invoke a LiveCycle Process Periodically

  1. Hi Jasmin
    Thanks for the post – very useful.
    I’d like to add a few things:
    1. I don’t believe you have to restart the process if the server shuts down and is restarted (although I haven’t checked this recently). Long lived processes should survive server restarts.
    2. Sometimes it’s necessary to be a little more explicit about the time of day or day of the week that a process runs. For example, every Monday morning at 7am, except if it’s a public holiday. We created a few components that give you quite sophisticated control over these types of schedules. More information here: http://manly.avoka.com.au/confluence/display/Public/Business+Time+DSC
    Have a great holiday season…
    Howard

  2. Jasmin Charbonneau says:

    Howard, thanks for the feedback. You’re absolutely right about the server restart. The long lived process should continue working without doing anything. When I wrote the blog, I was in a short lived mind set, and I got side tracked. I will edit the post.

    Great holiday season to you and all your team.

    Jasmin

  3. Diego Silva says:

    Great post!
    By the way, what options do I have if I need to do this, but in a short lived process?
    For example: Just the Rights Management module installed, and it was needed to call a webservice or a third database (another system) to check if a specific document was still valid and update it in LC. There was no way to call back (third system -> LiveCycle), I had to make LC do this check, instead.
    So, when Process Management is not installed, is it possible to use the Wait operation?

    • Parth Pandya says:

      Hi Diego,
      I don’t think that Wait operation is allowed/will work in short lived processes.
      Are you saying that ‘third system’ couldn’t talk to LC? I’m not sure about the whole scenario but if you create small utility processes in LC then you should be able to call those via WebService from the other system.

  4. Pingback: Como chamar processos do LiveCycle periodicamente « Diego Silva

  5. Jasmin says:

    You can only use the Wait in a long lived process.

    If you want to use a short lived process you’ll need to write a custom component to do the wait for you.

    Also if LiveCycle shuts down, you’ll need to invoke that process again to start the loop.

    I had originally wrote how to create a custom component that invokes a LiveCycle process when it first starts, to get around that problem, in this article, but I removed it after Howard’s comment. I’ll try to put that in a following post.

    Jasmin

    • Hi Jasmin,

      You don’t need to do it in a custom component for a short lived process. You can use the Scripting service. Just add an execute script action to your process with this code: Thread.sleep(X), where X is the number of milliseconds you want your process to wait.

  6. Another way to run a process at a given time under Unix-alike operating systems, is to simply add a little shell script in your cron. Since your processes are now available as REST services in LCES2, you can call them from within a browser, or, more shell-alike, from e.g. curl or wget.

    For instance, with wget
    wget http://yourserver:port/soap/services/YourApplication/YourProcess (you will have to add username and password to your command line, … man wget or man curl)

    Update your crontab to schedule the script and off you go.

    Note that you can do a similar thing on Windows with the Scheduler if you have a Windows version of those tools.

    Yves

    • Jasmin says:

      The reason I’d use a custom component is to leverage the onStart() method.

      The onStart() method would be called when the custom component start. If you put some code in the onStart() to invoke your short lived orchestration, then you know it’ll be called every time the service is started.

      This could be useful if you want to make sure to start the polling process automatically if the server is restarted, since the custom component will also get restarted.

      Jasmin

      That way