Wednesday, February 1, 2012

Hello World – OIM11g Schedulers

Introduction

An under the hood inspection of what happens when we run schedulers in OIM 11g. The intended audience for this experiment is experienced OIM 9.x developers who are learning OIM 11.x.

The Setup

I am using
Component
Version
Operating System
Windows 2003 R2 (Enterprise x64 Edition)
Application Server
Weblogic 10.3.5
Database Server
Oracle 11gR2
OIM
11.1.1.5.0

The Code


Two schedulers
oim.helloworld.scheduler.HelloWorldScheduler
oim.helloworld.scheduler.HelloWorldSleepyCatScheduler

HelloWorld Scheduler – The simplest case

I want to create a hello world style scheduler. It does nothing, other than printing out what is being invoked in the logs.
I registered my plug-in and then imported HelloWorldScheduler.xml for the metadata. Once this is done I could see my scheduler name in the Task list that is present in the scheduler creation list.


I added some fields in my HelloWorldScheduler.xml which came up here in the parameters section. Neat! I am all set to run the scheduler, so I click Save and Run Now.
Here is what I get:
For my case, the scheduler name, class name and the task name is all same so we see three functions getting the same value. Once that is done, the executeJob() method kicks in and in turn execute().
All the metadata that I built into my xml describing whether an attribute is optional or whether it is encrypted is available in the executeJob function. Here is the definition of JobParameter that is on the right hand side of the HashMap.

Once that is done, the out of box function passes on the control to the execute() method, giving it the HashMap which only has the key-value pair data and nothing else.

Hello World Sleepy Cat – The lazy scheduler


In the last scheduler, we did nothing other than seeing how the flow is going through. The scheduler finished almost immediately. This time we want to see how the stop functionality works. We will deliberately make the scheduler run for 20 seconds and then try to stop it from the web app.
So post the registration and metadata import I created this scheduler

I made one of my field mandatory, thus a (*) is shown beside the Dummy Boolean parameter.

Enough of registration, let us run!
Here is what I get

The execute method is still running and will finish after a period of 20 seconds. After a while I can see the END message printed in the logs.
Now that we have a sufficiently long running task, let me try to stop it from the web application.

The web app shows this
It shows me a interrupt status, but in the logs I did not see the stop() function being called. Missing functionality!

Hello World Scheduler – Start / Stop with APIs

Let us try to start the scheduler using APIs. Here is the code that I used

Here is what I get in the logs

Lets us try to start the sleep cat scheduler and try to stop it after 2 seconds. Here is the code that I used

Same result, the scheduler did not stop!
Let us try to pause it
Does not work! Is there something else I need to do?

Conclusion

The new scheduler registration system adds some neat features like declaring what is mandatory while creating the scheduler in OIM. However the older way of doing things was much simpler. The stop and the pause trigger for the scheduler do not seem to work.




Subject to local law, communications with Accenture and its affiliates including telephone calls and emails (including content), may be monitored by our systems for the purposes of security and the assessment of internal compliance with Accenture policy.
______________________________________________________________________________________

www.accenture.com

No comments:

Post a Comment