• Home
  • Blog
  • About
  • Archive
  • Wish List
  • ATOM 0.3
  • RSS 2.0
  •  

    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.

    &nbsp;&nbsp;public&nbsp;interface&nbsp;SubscriptionInterface<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;void&nbsp;onBusinessEvent(Subscription&nbsp;eo,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BusinessEvent&nbsp;event,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WorkflowContext&nbsp;ctx)&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;BusinessEventException;<br />&nbsp;&nbsp;}<br />&nbsp;&nbsp;

    Sample example of Java subscription is given below.

    public&nbsp;class&nbsp;HelloWorldSub&nbsp;implements&nbsp;SubscriptionInterface<br />{<br />&nbsp;&nbsp;private&nbsp;final&nbsp;String&nbsp;CLASS_PREFIX&nbsp;=&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HelloWorldSub.class.getName()&nbsp;+&nbsp;&quot;.&quot;;<br />&nbsp;&nbsp;private&nbsp;final&nbsp;String&nbsp;HELLO_WORLD&nbsp;=&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Hello&nbsp;World&nbsp;From&nbsp;JBES&nbsp;Subscription!&quot;;<br /><br />&nbsp;&nbsp;public&nbsp;void&nbsp;onBusinessEvent(Subscription&nbsp;eo,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BusinessEvent&nbsp;event,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WorkflowContext&nbsp;context)&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throws&nbsp;BusinessEventException<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;final&nbsp;String&nbsp;METHOD_NAME&nbsp;=&nbsp;&quot;onBusinessEvent()&quot;;<br />&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(HELLO_WORLD);<br />&nbsp;&nbsp;}<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.

    2 Responses to “Java Subscription for Workflow Business Events”

    1. Rathna Says:

      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

    2. Hardik Tank Says:

      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

    Leave a Reply

    Close
    E-mail It