Tuesday 28 January 2014


Naming your composite instance helps you to uniquely identify the instance.

Suppose you are receiving PurchaseOrder from end system and each Purchase Order has unique id so if we assign that Purchase Order unique id to composite name then we simple identify that which instance is processing which Purchase Order.
Follow below steps for composite Instance name

1.) Create a string variable and name it "CmpstTitleVar".
2.) Add assign activity after receive activity and assign variable value(e.g. Purchase Order Id) to CmpstTitleVar variable.
3.) Add java embedding activity after assign activity. In that activity add below function.
            
         setCompositeInstanceTitle((String)getVariableData("CmpstTitleVar"));


Or, little advance you can use the below code for fetching the host details for your composite title

String IntgTransactionID = "000000";                       
String AppTransactionID="0000";                       
String HostName = null;                             
    try{                                                                       
      InetAddress addr = InetAddress.getLocalHost();                                                        
          HostName = addr.getHostName();                                                  
      addAuditTrailEntry("Host name is " + HostName);                                                                       
          IntgTransactionID = (String)getVariableData("IntgTransactionID");   
          AppTransactionID = (String)getVariableData("AppTransactionID");                                               
        if(IntgTransactionID.length()<= 0) IntgTransactionID = "000000";   
        if (AppTransactionID.length() > 0)                 
        {            
           if (AppTransactionID.length() >= 12)        
            {        
           setCompositeInstanceTitle("IntId_"+IntgTransactionID+"_ApId_"+AppTransactionID.substring(0,12)+"_"+HostName);         
            }        
            else        
            {        
            setCompositeInstanceTitle("IntId_"+IntgTransactionID+"_ApId_"+AppTransactionID+"_"+HostName);        
            }        
         }         
         else                 
         {                 
            setCompositeInstanceTitle("IntId_"+IntgTransactionID+"_"+HostName);                        
        }          
    } 
      catch (Exception ex) {                                                                 
       ex.printStackTrace();                                                                 
        addAuditTrailEntry(ex.getMessage());                                                                  
    }


But do not forgot to import the below import statements for above code in .bpel file in between the process element and PartnerLinks
<process  . . . >
  <bpelx:exec import="java.util.*"/>
  <bpelx:exec import="java.lang.*"/>
  <bpelx:exec import="java.io.*"/>
  <bpelx:exec import="java.net.*"/>
  <bpelx:exec import="org.w3c.dom.Element"/>

  <partnerLinks> ....

2 comments: