Tuesday, March 7, 2017

Generate a Unique ID to be used as Correlation for Asynchronous flows in SOA

In case of asynchronous flow, sometimes we need a unique ID to track the flow across different system or different services. we can use the XSLT function oraext:generate-guid() to generate the ID.

In below example I am defining a variable as assigning the unique ID to it, and later restructuring.
you can also directly use it in a XSLT transformation.


      <variables>
        <variable name="correlationID" type="xsd:string">
          <from>oraext:generate-guid()</from>
        </variable>
      </variables>  

        <assign name="Assign_ServiceRequestDetails">
          <copy>
            <from>concat(substring($correlationID,1,8),'-',substring($correlationID,9,4),'-',substring($correlationID,13,4),'-',substring($correlationID,17,4),'-',substring($correlationID,21))</from>
            <to>$serviceRequest/ns14:CorrelationID</to>
          </copy>
       </assign>



After restructuring in assign:

This id can be use in all the subsequent bpel processes to track the flow.


8 comments: