Wednesday, February 23, 2011

Job Scheduling in Liferay 6

Following are the steps to schedule the job in Liferay 6.

1. Implement a class that will implement MessageListener Interface.



2. Then we need to tell liferay to run this job. So you add the following to your liferay-portlet.xml:


3. We need an actual portlet to attach this "scheduler-entry" to. So we also need the portlet.xml as usual.

Its Done!!!

10 comments:

  1. hello, good blog, and an excellent understand! one for my favorites.

    ReplyDelete
  2. Thanks, Keep posting and sharing...

    ReplyDelete
  3. this post should anyone print out and put on every bicycle in the world

    ReplyDelete
  4. Hey guy
    whenever i am configuring scheduler entry in liferay-portlet.xml i get error like portlet must match scheduler-entry tag.
    Please solve it

    ReplyDelete
  5. Hello Davendra,

    Make sure you are adhering to liferay-portlet.xml dtd rules and you are using Liferay 6 as Scheduling implementation has been changed a lot from liferay 5.2 to Liferay 6.

    Here you can find the liferay-portlet.xml dtd for Liferay 6

    http://docs.liferay.com/portal/6.0/definitions/liferay-portlet-app_6_0_0.dtd.org.html


    Regards

    ReplyDelete
  6. How do I set more than one schedulers for a given portal ?

    ReplyDelete
  7. I came across the same problem as stated above by Devendra.
    Also tried copy & paste code from this blog but no luck.
    I'm using Liferay 6.0.6 CE and following is my liferay-portlet.xml
    ---------------------------------------------------------------------------------------------







    SamplePortlet
    true
    false



    test
    com.sample.scheduler.MailScheduler


    1
    minute








    -------------------------------------------------------------------------------------------------------

    ReplyDelete
  8. Just figured it out.
    Need to change the element sequence.
    tag should be before and

    BTW, thanks for the blog.

    ReplyDelete
  9. [...] and check every midnight for the same. More about how to create schedulers in liferay is here http://www.liferaying.com/job-scheduling-in-liferay-6/ Flag Please sign in to flag this as [...]

    ReplyDelete