Creating Scheduler in OIM

OIM exposes scheduler APIs to perform long running tasks which may include huge data exchange, data processing which can be triggered periodically or on demand without any code changes.
Steps to create scheduler
  1. Create a Java class extending iam.scheduler.vo.TaskSupport.
  2. Override following methods
public void execute(HashMap attr) throws Exception {
final String USER_NAME = “User Name”;
final String USER_PASSWORD = “Password”;
                final String userName = (String) attrs.get(USER_NAME);
                final String password = (String) attrs.get(USER_PASSWORD);
                //business logic
}
                public HashMap getAttributes() {        return null;          }
                public void setAttributes() {        }
  1. Write business logic in the execute method
  2. Create plugin.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
                <plugins pluginpoint=”oracle.iam.scheduler.vo.TaskSupport”>
                                <plugin pluginclass=”fully qualified class name of scheduler”
                                                version=”1.0.1″ name=”scheduler element”>
                                </plugin>
                </plugins>
</oimplugins>
  1. Crete metadata.xml
<?xml version=’1.0′ encoding=’UTF-8′?>
                <task>
                                <name>task name of scheduler</name>
                                <class>fully qualified class name of class that extends TaskSupport</class>
                                <description>Schduler Description</description>
                                <retry>5</retry>
                                <parameters>
<string-param required=”true” encrypted=”false”
                                                                helptext=”User Name “>User Name</string-param>
                                                <string-param required=”true” encrypted=”false”
                                                                helptext=”Email “>Email</string-param>
                                </parameters>
                </task>
</scheduledTasks>
Create a plugin zip and register it using OIM plugin utility or via APIs.
After plugin registration go to sysadmin console and click on scheduler.
Then click on + to create new schedule job by selecting the task name as mentioned in XML file.
And set the other parameters as per your requirements.
This will create a schedule job for your scheduled task.
Running this scheduler will execute your custom scheduler code.

Comments

Popular posts from this blog

Troubleshooting Scheduler plugin in OIM

Using While Loop in SOA BPEL

Using OIMService API for raising request