Results 1 to 2 of 2

Thread: Adding JobExecutionListener Programatically

  1. #1

    Default Adding JobExecutionListener Programatically

    Hello,

    I want to add a JobExecutionListener to Jobs programatically. Is there a way?

    I'm trying to have something like a Global JobExecutionListener. I discover a list of the jobs registered in the application context, and want to add my Listener to each of them. The idea behind is to get an update on each job as it gets fired/completed.

    Also, the Job interface does not have methods to add the listener? Even if I get hold of an instance of job how do I add it?
    -Amit

  2. #2
    Join Date
    Feb 2008
    Posts
    488

    Default

    Usually it's better to do these sorts of things in the xml. You could, for instance, create an abstract <job/> that only has the listener on it and then all of your concrete jobs could have a parent= attribute that references it (thus inheriting the listener).

    If you really want to do it programmatically, you can do it with a BeanPostProcessor.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •