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 <[EMAIL PROTECTED]> 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.