Friday, August 26, 2011

Programming a Schedule Job !!! Dynamic job

I find dynamic schedule jobs a very useful feature in Websphere commerce. It is very useful for jobs that require to be dynamically generated based on some programming logic in a command. e.g. if there are emails that need to be triggered based on a event or any admin action that requires a schedule job to run to generate reports.

AddJobCmd addJobCmd =
(AddJobCmd) CommandFactory.createCommand(
AddJobCmd.class.getName(),
commandContext.getStoreId());
addJobCmd.setQueryString();
addJobCmd.setForUserId();
addJobCmd.setStartTime();
addJobCmd.setPathInfo("");
addJobCmd.setUrl(); //Even though this is not checked in validate parameters, this is required
addJobCmd.setStoreId(new Integer(SITE_STORE));
addJobCmd.setCommandContext(commandContext);
addJobCmd.setAccCheck(false);
addJobCmd.execute();
addJobCmd.setAccCheck(true);


recurring Jobs needs these extra methods to be configured:

addJobCmd.setAttempts()
addJobCmd.setDelay()
addJobCmd.setInterval()


21 comments:

  1. Hi,

    Found your blog very useful, just a small request:-

    Lot of times in interview I have been asked the sequence in which the out of box commands and task commands are called for flows like ordering , logging in and other common flows . I tried a lot but i have not been able to decode the exact sequence. It will be very beneficial for me and lot of other readers of this blog if you can write a dedicated blog on this sequence.

    ReplyDelete
  2. I will write something on the sequence of controller command task commands for Order flow and Login\Registration flow.

    ReplyDelete
  3. This is already done,
    http://www.ibmwcs.com/2011/09/order-login-flow-commands.html

    ReplyDelete
  4. Hi, This is useful info. Is there any way to programatically, know if an instance of this job is already running. I need to implement something like: schedule a job if it is not already running.

    Thanks In Advance!

    ReplyDelete
  5. which parameter should be used to execute custom controller command.. I mean I have to execute a custom command in asynchronous manner what parameters should be set in AddJobCmd

    ReplyDelete
  6. This process up may take the form of keyword selection in a search engine or any number of methods with point and click directories. It's important for contractors to study the job posting and keyword guidelines of the hosting job board since they will differ from site to site.guarantor

    ReplyDelete
  7. This bit of blog shows commitment of author.
    Resumeyard

    ReplyDelete
  8. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained!
    f&b resume template

    ReplyDelete
  9. Thank you for sharing a bunch of this quality contents, I have bookmarked your blog. Please also explore advice from my site. I will be back for more quality contents. tim viec lam them 365

    ReplyDelete
  10. It’s very informative and you are obviously very knowledgeable in this area. You have opened my eyes to varying views on this topic with interesting and solid content. job board

    ReplyDelete
  11. Friend, this web site might be fabolous, i just like it. job posting

    ReplyDelete
  12. I got too much interesting stuff on your blog. I guess I am not the only one having all the enjoyment here! Keep up the good work. job posting site

    ReplyDelete
  13. Thanks for the nice blog. It was very useful for me. I'm happy I found this blog. Thank you for sharing with us,I too always learn something new from your post.
    Jobs in Dubai

    ReplyDelete
  14. Contractors should put the right keywords in the right place so that the right people can find their job postings. Online job postings are not viewed the way print classified ads are viewed.Cover letter

    ReplyDelete
  15. It’s very informative and you are obviously very knowledgeable in this area. You have opened my eyes to varying views on this topic with interesting and solid content. termtechreview

    ReplyDelete
  16. Your website is really cool and this is a great inspiring article. Thank you so much. instagram likes instantly free

    ReplyDelete
  17. You establish a career purpose when you have a set of goals, ashamed of being unemployed establish priorities for those goals, create a timeline for completion of the top priorities, and develop a proactive working plan.

    ReplyDelete
  18. Remorsefully, the full paid form of the IDE isn't modest, and likely not proper for a specialist,excel vba training london

    ReplyDelete
  19. I would like to say that this blog really convinced me to do it! Thanks, very good post. applicant tracking system

    ReplyDelete
  20. This comment has been removed by the author.

    ReplyDelete