You are on page 1of 2

SCHEDULER – The Procedural Overview

First we have to create a custom scheduler command and then after we will do the
configuration part.

Creating Custom Scheduler Command:


1) Create a custom scheduler interface

package com.ibm.commerce.sample;
import com.ibm.commerce.command.ControllerCommand;

public interface MyCustomSchedulerCmd extends ControllerCommand {


public static final String
defaultCommandClassName="com.ibm.commerce.sample.MyCustomSchedulerCmdImpl";
}

2) Create a custom scheduler implementation class

package com.ibm.commerce.sample;
import java.util.logging.Logger;
import com.ibm.commerce.command.ControllerCommandImpl;
import com.ibm.commerce.exception.ECException;

public class MyCustomSchedulerCmdImpl extends ControllerCommandImpl implements


MyCustomSchedulerCmd {
Logger logger = Logger.getLogger(MyCustomSchedulerCmdImpl.class.getName());

public void performExecute() throws ECException {


//implement custom logic
logger.info("My custom scheduler");
}
}

3) Make a struts config entry for custom command

<action path="/MyCustomScheduler"
parameter="com.ibm.commerce.sample.MyCustomSchedulerCmd"
type="com.ibm.commerce.struts.BaseAction">
<set-property property="authenticate" value="0:0"/>
<set-property property="https" value="0:1"/>
</action>

Scheduler Configuration Through DB Queries: [Method – 1]


We need to make a new DB entry in the below mentioned tables.

INSERT INTO SCHCONFIG


(SCCJOBREFNUM,SCCHOST,MEMBER_ID,STOREENT_ID,SCCRECDELAY,SCCRECATT,SCCPATHINFO,SCCQ
UERY,
SCCSTART,SCCINTERVAL,SCCPRIORITY,SCCSEQUENCE,SCCACTIVE,SCCAPPTYPE,INTERFACENAME,OP
TCOUNTER) VALUES ((SELECT MAX(SCCJOBREFNUM)+1 FROM SCHCONFIG),NULL, -1000,0,
0,0,'MyCustomScheduler',NULL, CURRENT_TIMESTAMP, 120,
1,0,'A',default,'com.ibm.commerce.sample.MyCustomSchedulerCmd',0);
INSERT INTO SCHACTIVE (SCSINSTREFNUM,SCSJOBNBR,SCSACTLSTART,SCSATTLEFT,SCSEND,
SCSINSTRECOV,SCSPREFSTART,SCSQUEUE,SCSRESULT,SCSSEQUENCE,SCSSTATE,SCSPRIORITY,OPTC
OUNTER) VALUES ((SELECT MAX(SCSINSTREFNUM)+1 FROM SCHACTIVE),(SELECT
MAX(SCCJOBREFNUM) FROM SCHCONFIG),
SYSDATE,1,NULL,NULL,CURRENT_TIMESTAMP,NULL,NULL,0,'I',default,0);

You might also like