Java Subscription for Workflow Business Events
One of the good features that Oracle Application Suite 11.5.10 has come up with is support for Java language for Workflow Business Event subscriptions and generator rules.
We will see, how we can create a new Java subscription and attach it to a Workflow Business Event.
Before jumping into code, please make sure you have OWF-H (3258819). To have more details and to download the same please refer Oracle Metalink page.
The Java Business Event System provides a simple subscription interface to write subscriptions. Developers must use following Java interface to create Java class that can be used to register it as event subscription.
public interface SubscriptionInterface<br /> {<br /> void onBusinessEvent(Subscription eo, <br /> BusinessEvent event, <br /> WorkflowContext ctx) <br /> throws BusinessEventException;<br /> }<br />
Sample example of Java subscription is given below.
public class HelloWorldSub implements SubscriptionInterface<br />{<br /> private final String CLASS_PREFIX = <br /> HelloWorldSub.class.getName() + ".";<br /> private final String HELLO_WORLD = <br /> "Hello World From JBES Subscription!";<br /><br /> public void onBusinessEvent(Subscription eo, <br /> BusinessEvent event, <br /> WorkflowContext context) <br /> throws BusinessEventException<br /> {<br /> final String METHOD_NAME = "onBusinessEvent()";<br /> System.out.println(HELLO_WORLD);<br /> }<br />}
Q: How can I register my Java class as a subscription for an event?
A: Follow following steps,
* Login in Oracle Application using ‘System Administrator’ username and password (ie sysadmin/sysadmin)
* Select ‘Workflow Administrator Web Applications’ responsibility
* Go to ‘Administrator Workflow’ -> ‘Business Events’ menu
* Select ‘Subscription’ from the menu
* Click on ‘Create Subscription’ button
* Give necessary parameters like, System, Source Type, Event Filter, Phase etc
* Event Filter is the event name for which you want to subscribe Java class
* Specify ‘Custom’ as ‘Action Type’
* Click ‘Next’
* Specify java class name with package (ie oracle.apps.csf.wireless.sql.DemoSubscription)in ‘Java Rule Function’
* Provide values for priority, Owner Name and tag.
* Click Apply
Your Java subscription has been assigned to the business specified by you.
Make sure ‘Workflow Java Deferred Agent Listener’ is running from Oracle Application Manager’s workflow page.
Q: How can I see log messages put in my code?
A: Log messages can be seen at ‘Workflow Java Deferred Agent Listener’ logs. For this you need to go to Oracle Application Manager -> Workflow. Here select this agent listener and click on ‘View Log’ button.
Q: Where should I place my class file, so that Workflow engine can load it?
A: For the Java subscription to be executed correctly, you must copy your jar files to the Concurrent Processing node and update the Java class path (AF_CLASSPATH) environment variable.
Note: Please use the standard procedures documented in the Oracle MetaLink Note 130091.1 to update the AF_CLASSPATH variable.

Posted by Hardik
May 22nd, 2006 at 11:24 pm
Hi,
I was browsing for the solution for problem I am facing i.e. How can I see log messages put in my code? Its TODO in your blog.
I could not find it in jserv logs. Can you please let me know.
Thanks,
Rathna
June 20th, 2006 at 6:37 pm
Here, all the System.out.println() will not go to jserv.log but same you can see at ‘Workflow Java Deferred Agent Listener’ logs. For this you need to go to Oracle Application Manager -> Workflow. Here select this agent listener and click on ‘View Log’ button.
Hope this helps.
- Hardik