1. ODE
  2. ODE-91

Capturing Business Process Data through EventHandler


    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-incubating
    • Fix Version/s: 1.0-incubating
    • Component/s: BPEL Runtime
    • Labels:


      ODE Business Process Data capture through Event Listeners: Proposal

      (Plaintext of the Proposal)
      It is necessary to get Business process data through events to track what's going on with the process using the data flow. It's also useful for Business Activity Monitoring (BAM) solution to get 'What's happening right now?' type of data.
      Currently ode fires events and can be captured through Event Listener mechanism. But to get the data, we have to use pmapi (through web services).
      So, the proposal is to get the data, in Event listeners with out using the web services. How to consume the events is up to the Event Handlers.
      For that, we have to add a BpelEventContext in BpelEvent object, which will carry the event context to the Event Listeners. The BpelEventContext interface carries two public methods.
      1.public String[] getVariableNames();
      2.public String getVariableData(String varName);

      The getVariableNames() returns all variable names available in that event context as an array of String. It will return null, if no variable is available.
      The getVariableData(varName) returns the variable data, for the given variable name, if exists and initialized, as a String representation of DOM Node. Otherwise it will be null.

      The BpelEventContext implementation BpelEventContextImpl implements these methods. It takes OScope object, scopeInstanceId and BpelRuntimeContext as constructor parameters. Using these values, it's easy to return the variable names and its data.
      In BpelEvent a public property is needed to carry the BpelEventContext. For that purpose add the following in the BpelEvent.java
      public transient BpelEventContext eventContext;

      To populate the context, in ACTIVITY.java, where the ScopeEvent got populated, add the following method.

      • Populate BpelEventContext, to be used by Registered Event Listeners
      • @param event ScopeEvent
        protected void fillEventContext(ScopeEvent event)
        BpelEventContext eventContext = new BpelEventContextImpl(
        _scopeFrame.oscope, _scopeFrame.scopeInstanceId,
        event.eventContext = eventContext;

      And in protected void sendEvent(ScopeEvent event), call this method to populate the BpelEventContext.

      How to consume event data?
      Here is a code snippet to consume the event data.

      public void onEvent(BpelEvent event)

      if(event instanceof ActivityExecStartEvent)
      String[] __names = ((ActivityEvent)event).eventContext.getVariableNames();
      if(__names != null)
      System.out.println(">>>>>>> Variable Data...");
      for(int i = 0; i < __names.length; i++)
      String varName = __names[i];
      System.out.println(">>>>>>> For Variable ..." + varName);
      String data = ((ActivityEvent)event).eventContext. getVariableData(
      if(data != null)

      { System.out.println(DOMUtils.prettyPrint( DOMUtils.stringToDOM(data))); }


      { System.out.println(".....DATA Not Available......"); }

      System.out.println(">>>>>>> Variable Data ENDS...");

      catch(Exception e)

      { e.printStackTrace(); }


      1. ode_proposal_source.zip
        4 kB
        Raja Balasubramanian
      2. Ode Business Data capture_proposal.doc
        32 kB
        Raja Balasubramanian


        Raja Balasubramanian added a comment -

        Proposal Description

        Raja Balasubramanian added a comment - Proposal Description
        Raja Balasubramanian added a comment -

        Java Source

        Raja Balasubramanian added a comment - Java Source
        Matthieu Riou added a comment -

        Patch applied.

        Matthieu Riou added a comment - Patch applied.
        Maciej Szefler added a comment -

        Copied the text of the word document into the issue description.

        Maciej Szefler added a comment - Copied the text of the word document into the issue description.


          • Assignee:
            Raja Balasubramanian
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: