ODE
  1. ODE
  2. ODE-91

Capturing Business Process Data through EventHandler

    Details

    • 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:
      None

      Description

      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,
        getBpelRuntimeContext());
        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)
      {
      try
      {
      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(
      varName);
      if(data != null)

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

      else

      { 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

        Activity

        Raja Balasubramanian created issue -
        Raja Balasubramanian made changes -
        Field Original Value New Value
        Attachment Ode Business Data capture_proposal.doc [ 12349862 ]
        Raja Balasubramanian made changes -
        Attachment ode_proposal_source.zip [ 12349863 ]
        Matthieu Riou made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Maciej Szefler made changes -
        Description ODE Business Process Data capture through Event Listeners: Proposal
        See attached document for details.
        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,
                                                getBpelRuntimeContext());
            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)
            {
                try
                {
                    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(
        varName);
        if(data != null)
        {
        System.out.println(DOMUtils.prettyPrint(
        DOMUtils.stringToDOM(data)));
        }
        else
        {
        System.out.println(".....DATA Not Available......");
        }
        }
        System.out.println(">>>>>>> Variable Data ENDS...");
        }

        }
                 catch(Exception e)
        {
        e.printStackTrace();
        }
            }
        }
        Matthieu Riou made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development