WebSphere Extended Deployment, Version 6.0.x
             Operating Systems: AIX, HP-UX, Linux, Solaris, Windows, z/OS


Using the base scheduler in WebSphere Application Server with the job scheduler

The job scheduler Enterprise JavaBeans (EJB) interface is used to programmatically submit and manipulate a business grid job. You can use the EJB interface in conjunction with the base scheduler in WebSphere Application Server to perform calendar-based submission of a business grid job. This topic describes how to submit a business grid job to the job scheduler using the base scheduler in WebSphere Application Server.

Procedure

  1. Create and configure a scheduler. See the Developing and scheduling tasks for information on how to create and configure a scheduler.
  2. Create a scheduler task for submitting grid work. This scheduler task invokes the long-running scheduler EJB to submit a long-running job. See the Developing a task that calls a session bean topic in the WebSphere Application Server Version 6.0 information center for instructions for creating a task that invokes an EJB. This topic also includes instructions for using the calendaring feature of the WebSphere scheduler. The following task code example demonstrates on how to invoke the long-running scheduler EJB:
    // These are the import statements needed by the task
    import javax.naming.*;
    
    import com.ibm.websphere.longrun.JobScheduler;
    import com.ibm.websphere.longrun.JobSchedulerHome
    
    
    private JobSchedulerHome zjsHome = null;
    private JobScheduler zjs = null;
    
    
    public void process(TaskStatus task) ()
    try{
    
         //Ensure that the xJCL can be placed in a string, for example, by reading an xJCL
         //File into a string
         String xJCL = <xJCL as a string>;
    
         //Obtain cell-level naming context
         InitialContext ctxt = new InitialContext();
         Hashtable env = new Hashtable();
    
         env.put (Context.INITIAL_CONTEXT_FACTORY,
         "com.ibm.websphere.naming.WsnInitialContextFactory");
    
         env.put(Context.PROVIDER_URL,"corbaloc:rir:/NameServiceCellRoot");
         ctxt = new InitialContext(env);
    
         //To look up the LRS EJB from the cell context in the namespace,
         //The name context to the application server or cluster to which the LRS 
         //Application is deployed has to be provided
         //Eg: "nodes/myNode/servers/myServer" or "clusters/myCluster".
    
         String longRunningContext = <long_running_context>;
    
    
         zjsHome = (JobSchedulerHome) ctxt.lookup(longRunningContext +
         "/ejb/com/ibm/websphere/longrun/JobSchedulerHome");
         zjs = zjsHome.create();
         zjs.submitJob( xJCL );
    
    }catch (Exception e) {
    System.out.println(e.getMessage());
    }
    
  3. Schedule the scheduler task to submit grid work. Read aboutSubmitting a task to a scheduler in the WebSphere Application Server Version 6.0 Information Center.



Related concepts
Web services and EJB interfaces for the long-running scheduler
The long-running scheduler Web services interface
Task topic    

Terms of Use | Feedback

Last updated: Oct 16, 2009 11:14:15 AM EDT
http://publib.boulder.ibm.com/infocenter/wxdinfo/v6r0/index.jsp?topic=/com.ibm.websphere.xd.doc/info/reference/txdbgusweb.html