You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ode.apache.org by Viraf Bankwalla <vi...@yahoo.com> on 2007/01/26 20:19:16 UTC

Adding Business Relevant Data to Events

      There is a need to determine the state of a process and provide metrics on the process.  The current implementation of ODE provides the mechanism by which to emit events (as defined in ODE Execution Events), and notify observers of the event.  The event structure lacks the process context (“VariableData’) that may be needed by observers.  I would like to propose that ‘variableData’ be added to the ‘ScopeEvent’ so that observers have business context.  Your feedback on the proposed changes would be appreciated. 
   
  1.      The ScopeEvent would be updated to include
   
        private HashMap<String, String> variableData;
   
  2.      Populate variableData
  All events get fired from ACTIVITY object.  The following retrieves variable data and populates variableData in the scope object.  
   
  In org.apache.ode.bpel.runtime.ACTIVITY replace the code for sendEvent(ScopeEvent event) with the following code
   
  protected void sendEvent(ScopeEvent event)      
  {
      if (event.getLineNo() == -1 && _self.o.debugInfo != null) 
      {
          event.setLineNo(_self.o.debugInfo.startLine);
      }
      _scopeFrame.fillEventInfo(event);
      fillVariableInfo(event);   // Add variableData to ScopeEvent
      getBpelRuntimeContext().sendEvent(event);
  }
   
  /**
  * Adds process context to the ScopeEvent as variableData
  *
   * @param event The ScopeEvent to which the process context is to be added
   */
  protected void fillVariableInfo(ScopeEvent event)
  {
      HashMap<String,String> variableData = new HashMap<String,String>();
      Iterator<String> variableNames = _scopeFrame.oscope.variables.keySet().iterator();
      while(variableNames.hasNext())
      {
          String name = variableNames.next();
          String value = "";
          Variable var = _scopeFrame.oscope.variables.get(name);
          VariableInstance varInst = _scopeFrame.resolve(var);
          try 
          {
              Node varNode = getBpelRuntimeContext().fetchVariableData(varInst, false);
              value = DOMUtils.domToString(varNode);
          } 
          catch (FaultException e) 
          {
          }
          variableData.put(name, value);
        }
    event.setVariableData(variableData);
  }
  

Look forward to your commnets.
 Thanks
- viraf

  
 
---------------------------------
Have a burning question? Go to Yahoo! Answers and get answers from real people who know.

Re: Adding Business Relevant Data to Events

Posted by Alex Boisvert <bo...@intalio.com>.
Did you take a look at the "Event Listeners" section at the bottom of
http://incubator.apache.org/ode/ode-execution-events.html ?  Does this
satisfy your requirement?

alex

On 1/29/07, Viraf Bankwalla <vi...@yahoo.com> wrote:
>
> Thanks - for my last question I was wondering if there are already plans /
> work done on providing a mechanism by which to capture business relevant
> data through event handlers.  If so, I could leverage that work.  If not, we
> can Maxeij's recommendations.
>
> Thanks - viraf
>

Re: Adding Business Relevant Data to Events

Posted by Viraf Bankwalla <vi...@yahoo.com>.
Thanks - for my last question I was wondering if there are already plans / work done on providing a mechanism by which to capture business relevant data through event handlers.  If so, I could leverage that work.  If not, we can Maxeij's recommendations.

Thanks - viraf

Alex Boisvert <bo...@intalio.com> wrote: On 1/29/07, Maciej Szefler  wrote:
>
>
> >  Is the capture of event data currently under consideration or
> development
> > ?  If so, does the implementation follow your proposal ?  If this is not
> > under consideration / development would this be something that would be
> > added to the ode codebase?
>
>
> Events are currently captured in the  database. There is a setting in the
> deployment descriptor that controls which events are captured.
>
>
And the documentation is here:
http://incubator.apache.org/ode/ode-execution-events.html

alex


 
---------------------------------
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.

Re: Adding Business Relevant Data to Events

Posted by Alex Boisvert <bo...@intalio.com>.
On 1/29/07, Maciej Szefler <mb...@intalio.com> wrote:
>
>
> >  Is the capture of event data currently under consideration or
> development
> > ?  If so, does the implementation follow your proposal ?  If this is not
> > under consideration / development would this be something that would be
> > added to the ode codebase?
>
>
> Events are currently captured in the  database. There is a setting in the
> deployment descriptor that controls which events are captured.
>
>
And the documentation is here:
http://incubator.apache.org/ode/ode-execution-events.html

alex

Re: Adding Business Relevant Data to Events

Posted by Maciej Szefler <mb...@intalio.com>.
Viraf,

see comments in,ine

On 1/26/07, Viraf Bankwalla <vi...@yahoo.com> wrote:

>    I noticed that you proposed the context to be added to BpelEvent.  My
> understanding was that the process variables would only be available for
> Scope events.  What other information do you think would be useful ?

No reason to limit it to just scope events. In addition to variables there
is the value of correlation sets that may be of interest.

   Could you point me to an example that I can use as a basis to get process
> variables given a scope id.


Take a look at ProcessManagement.java and InstanceManagement.java. If you
look in the Axis2 module there is a web service that makes use of these
interfaces to expose the functionality as a SOAP service.

   Is the capture of event data currently under consideration or development
> ?  If so, does the implementation follow your proposal ?  If this is not
> under consideration / development would this be something that would be
> added to the ode codebase?


Events are currently captured in the  database. There is a setting in the
deployment descriptor that controls which events are captured.

-maciej

Thanks - viraf
>
>
>
> Maciej Szefler <mb...@intalio.com> wrote: Viraf,
>
> I think what you are after is a valid use case. However, the proposed
> implementation is not practical. There is simply too much variable
> data to be loading it from the store every time an event is issued.
> Not only would it be expensive to read this data, but it would make
> persistence of the events very expesnive as well. What would make more
> sense is to provide a "context" object for the listeners that would be
> able to retrieve the information on demand. (as opposed to
> pre-populating the event object with this information). That way if
> your listener is interested in some variable it could easily obtain
> it. This is possible currently (with PMAPI), but it is rather
> inconvenient. So basically something along the lines:
>
> class BpelEvent {
>   ...
>   public transient BpelEventContext context;
>   ...
> }
>
> interface BpelEventContext  {
>    getVariableData(scopeId, varname);
>    .
>    .
> }
>
>
> -mbs
>
> On 1/26/07, Viraf Bankwalla  wrote:
> >       There is a need to determine the state of a process and provide
> metrics on the process.  The current implementation of ODE provides the
> mechanism by which to emit events (as defined in ODE Execution Events), and
> notify observers of the event.  The event structure lacks the process
> context ("VariableData') that may be needed by observers.  I would like to
> propose that 'variableData' be added to the 'ScopeEvent' so that observers
> have business context.  Your feedback on the proposed changes would be
> appreciated.
> >
> >   1.      The ScopeEvent would be updated to include
> >
> >         private HashMap variableData;
> >
> >   2.      Populate variableData
> >   All events get fired from ACTIVITY object.  The following retrieves
> variable data and populates variableData in the scope object.
> >
> >   In org.apache.ode.bpel.runtime.ACTIVITY replace the code for
> sendEvent(ScopeEvent event) with the following code
> >
> >   protected void sendEvent(ScopeEvent event)
> >   {
> >       if (event.getLineNo() == -1 && _self.o.debugInfo != null)
> >       {
> >           event.setLineNo(_self.o.debugInfo.startLine);
> >       }
> >       _scopeFrame.fillEventInfo(event);
> >       fillVariableInfo(event);   // Add variableData to ScopeEvent
> >       getBpelRuntimeContext().sendEvent(event);
> >   }
> >
> >   /**
> >   * Adds process context to the ScopeEvent as variableData
> >   *
> >    * @param event The ScopeEvent to which the process context is to be
> added
> >    */
> >   protected void fillVariableInfo(ScopeEvent event)
> >   {
> >       HashMap variableData = new HashMap();
> >       Iterator variableNames =
> _scopeFrame.oscope.variables.keySet().iterator();
> >       while(variableNames.hasNext())
> >       {
> >           String name = variableNames.next();
> >           String value = "";
> >           Variable var = _scopeFrame.oscope.variables.get(name);
> >           VariableInstance varInst = _scopeFrame.resolve(var);
> >           try
> >           {
> >               Node varNode =
> getBpelRuntimeContext().fetchVariableData(varInst, false);
> >               value = DOMUtils.domToString(varNode);
> >           }
> >           catch (FaultException e)
> >           {
> >           }
> >           variableData.put(name, value);
> >         }
> >     event.setVariableData(variableData);
> >   }
> >
> >
> > Look forward to your commnets.
> >  Thanks
> > - viraf
> >
> >
> >
> > ---------------------------------
> > Have a burning question? Go to Yahoo! Answers and get answers from real
> people who know.
> >
>
>
>
> ---------------------------------
> Any questions?  Get answers on any topic at Yahoo! Answers. Try it now.
>

Re: Adding Business Relevant Data to Events

Posted by Viraf Bankwalla <vi...@yahoo.com>.
Thanks for your comments.  I too was concerned about what the performance impact would be.  I have a couple of questions:


   I noticed that you proposed the context to be added to BpelEvent.  My understanding was that the process variables would only be available for Scope events.  What other information do you think would be useful ?

   Could you point me to an example that I can use as a basis to get process variables given a scope id.
   Is the capture of event data currently under consideration or development ?  If so, does the implementation follow your proposal ?  If this is not under consideration / development would this be something that would be added to the ode codebase?
Thanks - viraf



Maciej Szefler <mb...@intalio.com> wrote: Viraf,

I think what you are after is a valid use case. However, the proposed
implementation is not practical. There is simply too much variable
data to be loading it from the store every time an event is issued.
Not only would it be expensive to read this data, but it would make
persistence of the events very expesnive as well. What would make more
sense is to provide a "context" object for the listeners that would be
able to retrieve the information on demand. (as opposed to
pre-populating the event object with this information). That way if
your listener is interested in some variable it could easily obtain
it. This is possible currently (with PMAPI), but it is rather
inconvenient. So basically something along the lines:

class BpelEvent {
  ...
  public transient BpelEventContext context;
  ...
}

interface BpelEventContext  {
   getVariableData(scopeId, varname);
   .
   .
}


-mbs

On 1/26/07, Viraf Bankwalla  wrote:
>       There is a need to determine the state of a process and provide metrics on the process.  The current implementation of ODE provides the mechanism by which to emit events (as defined in ODE Execution Events), and notify observers of the event.  The event structure lacks the process context ("VariableData') that may be needed by observers.  I would like to propose that 'variableData' be added to the 'ScopeEvent' so that observers have business context.  Your feedback on the proposed changes would be appreciated.
>
>   1.      The ScopeEvent would be updated to include
>
>         private HashMap variableData;
>
>   2.      Populate variableData
>   All events get fired from ACTIVITY object.  The following retrieves variable data and populates variableData in the scope object.
>
>   In org.apache.ode.bpel.runtime.ACTIVITY replace the code for sendEvent(ScopeEvent event) with the following code
>
>   protected void sendEvent(ScopeEvent event)
>   {
>       if (event.getLineNo() == -1 && _self.o.debugInfo != null)
>       {
>           event.setLineNo(_self.o.debugInfo.startLine);
>       }
>       _scopeFrame.fillEventInfo(event);
>       fillVariableInfo(event);   // Add variableData to ScopeEvent
>       getBpelRuntimeContext().sendEvent(event);
>   }
>
>   /**
>   * Adds process context to the ScopeEvent as variableData
>   *
>    * @param event The ScopeEvent to which the process context is to be added
>    */
>   protected void fillVariableInfo(ScopeEvent event)
>   {
>       HashMap variableData = new HashMap();
>       Iterator variableNames = _scopeFrame.oscope.variables.keySet().iterator();
>       while(variableNames.hasNext())
>       {
>           String name = variableNames.next();
>           String value = "";
>           Variable var = _scopeFrame.oscope.variables.get(name);
>           VariableInstance varInst = _scopeFrame.resolve(var);
>           try
>           {
>               Node varNode = getBpelRuntimeContext().fetchVariableData(varInst, false);
>               value = DOMUtils.domToString(varNode);
>           }
>           catch (FaultException e)
>           {
>           }
>           variableData.put(name, value);
>         }
>     event.setVariableData(variableData);
>   }
>
>
> Look forward to your commnets.
>  Thanks
> - viraf
>
>
>
> ---------------------------------
> Have a burning question? Go to Yahoo! Answers and get answers from real people who know.
>


 
---------------------------------
Any questions?  Get answers on any topic at Yahoo! Answers. Try it now.

Re: Adding Business Relevant Data to Events

Posted by Maciej Szefler <mb...@intalio.com>.
Viraf,

I think what you are after is a valid use case. However, the proposed
implementation is not practical. There is simply too much variable
data to be loading it from the store every time an event is issued.
Not only would it be expensive to read this data, but it would make
persistence of the events very expesnive as well. What would make more
sense is to provide a "context" object for the listeners that would be
able to retrieve the information on demand. (as opposed to
pre-populating the event object with this information). That way if
your listener is interested in some variable it could easily obtain
it. This is possible currently (with PMAPI), but it is rather
inconvenient. So basically something along the lines:

class BpelEvent {
  ...
  public transient BpelEventContext context;
  ...
}

interface BpelEventContext  {
   getVariableData(scopeId, varname);
   .
   .
}


-mbs

On 1/26/07, Viraf Bankwalla <vi...@yahoo.com> wrote:
>       There is a need to determine the state of a process and provide metrics on the process.  The current implementation of ODE provides the mechanism by which to emit events (as defined in ODE Execution Events), and notify observers of the event.  The event structure lacks the process context ("VariableData') that may be needed by observers.  I would like to propose that 'variableData' be added to the 'ScopeEvent' so that observers have business context.  Your feedback on the proposed changes would be appreciated.
>
>   1.      The ScopeEvent would be updated to include
>
>         private HashMap<String, String> variableData;
>
>   2.      Populate variableData
>   All events get fired from ACTIVITY object.  The following retrieves variable data and populates variableData in the scope object.
>
>   In org.apache.ode.bpel.runtime.ACTIVITY replace the code for sendEvent(ScopeEvent event) with the following code
>
>   protected void sendEvent(ScopeEvent event)
>   {
>       if (event.getLineNo() == -1 && _self.o.debugInfo != null)
>       {
>           event.setLineNo(_self.o.debugInfo.startLine);
>       }
>       _scopeFrame.fillEventInfo(event);
>       fillVariableInfo(event);   // Add variableData to ScopeEvent
>       getBpelRuntimeContext().sendEvent(event);
>   }
>
>   /**
>   * Adds process context to the ScopeEvent as variableData
>   *
>    * @param event The ScopeEvent to which the process context is to be added
>    */
>   protected void fillVariableInfo(ScopeEvent event)
>   {
>       HashMap<String,String> variableData = new HashMap<String,String>();
>       Iterator<String> variableNames = _scopeFrame.oscope.variables.keySet().iterator();
>       while(variableNames.hasNext())
>       {
>           String name = variableNames.next();
>           String value = "";
>           Variable var = _scopeFrame.oscope.variables.get(name);
>           VariableInstance varInst = _scopeFrame.resolve(var);
>           try
>           {
>               Node varNode = getBpelRuntimeContext().fetchVariableData(varInst, false);
>               value = DOMUtils.domToString(varNode);
>           }
>           catch (FaultException e)
>           {
>           }
>           variableData.put(name, value);
>         }
>     event.setVariableData(variableData);
>   }
>
>
> Look forward to your commnets.
>  Thanks
> - viraf
>
>
>
> ---------------------------------
> Have a burning question? Go to Yahoo! Answers and get answers from real people who know.
>