You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ode.apache.org by "Matthieu Riou (JIRA)" <ji...@apache.org> on 2007/05/30 00:07:25 UTC

[jira] Closed: (ODE-91) Capturing Business Process Data through EventHandler

     [ https://issues.apache.org/jira/browse/ODE-91?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthieu Riou closed ODE-91.
----------------------------


> Capturing Business Process Data through EventHandler
> ----------------------------------------------------
>
>                 Key: ODE-91
>                 URL: https://issues.apache.org/jira/browse/ODE-91
>             Project: Ode
>          Issue Type: New Feature
>          Components: BPEL Runtime
>    Affects Versions: 1.0-incubating
>            Reporter: Raja Balasubramanian
>             Fix For: 1.0-incubating
>
>         Attachments: Ode Business Data capture_proposal.doc, ode_proposal_source.zip
>
>
> 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();
> 	 }
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.