Showing posts with label Oracle BPEL. Show all posts
Showing posts with label Oracle BPEL. Show all posts

Saturday, October 19, 2013

OnEvent functionality of Oracle BPEL 2.0 for parallel processing

                           One of my recent projects involved automation of account creation in multiple systems, using multiple workflow process. There was a main process which was controlling the rest of the flow. One of the requirements was to give option to admins or the super user to cancel the workflow or process flow at any point of time during their execution.
This feature was required so that in case if the Admin see’s foul play or someone trying to create a suspicious account, the support team or admins should be able to cancel or terminate the request and invalidate the changes performed by the request.
  This was an interesting use case where we can leverage the OnEvent functionality of BPEL 2.0 .In BPEL 1.1 there was option of OnMessage which has been replaced with OnEvent. Even though the name is OnEvent it is more of a service call with separate one way operation defined as part of the main service.
So if you have a Service, you can define multiple operations which can be used as part the OnEvent.
In case you want to know the status of the long running process, you can define a getProcessStatus operation which should ideally check the status parallel in the flow and send notification or asynchronous callback to return you the status. The OnEvents are all async in nature.
Couple of use cases would be to update the request details on the fly using an onEvent. Canceling and terminating the request, and in case if compensation needs to be done can handled in the onEventHandler.







   <wsdl:operation name="request">
            <wsdl:input message="client:EventTestRequestMessage"/>
        </wsdl:operation>
        <wsdl:operation name="getStatus">
            <wsdl:input message="client:EventTestStatusRequestMessage"/>
        </wsdl:operation>
        <wsdl:operation name="cancelRequest">
            <wsdl:input message="client:EventTestCancelRequestMessage"/>
        </wsdl:operation>
        <wsdl:operation name="updateRequest">
            <wsdl:input message="client:EventTestRequestMessage"/>
        </wsdl:operation>

When you select onEvent, you expectation will be to see a partnerlink which will accept a service operation or an event subscription. But in BPEL 2.0 Oracle implementation it’s only the service operation option that is available. I am not sure why they didn’t want to have event subscribers also in the parallel scope. It would have given us more options to play with EDN and have event created for different processes.



The only tricky part here is to correlate the instances, so you will need to add a unique identifier like a requestId, or combination of UserId and requestId to correlate the instances and can trigger the events.




You can always define onEvent on different scopes, so if you divide your process into multiple scopes and define OnEvents you will get multiple parallel entry points into your existing /running process, which gives you a lot of flexibility in terms of cleaning up or handling different complex scenarios.
If we design a solution with an onEvent flow for reprocessing, then the flow will come in handy for re-processing the scope again for the instances based on run time decisions. So plan ahead and have a handler for defining the logic which can interfere with the existing process flow and reach a different state of completion.
So our solution had terminate Request service exposed to the application which will trigger cancel Request OnEvent of all the participating processes there by terminating the particular request.
Hope this helps J
References:-

Saturday, August 17, 2013

Book review- Oracle SOA Suite 11g Performance Tuning Cookbook



This book covers almost all aspects of the performance tuning starting from the weblogic server to different SOA components. The highlight being detailed steps on different options available to analyze and troubleshoot the issues.
The modularization of the book is really good. The book starts with the soa infrastructure, listing the different options of monitoring the JVM’s, SOA suite and different components like bpel, rules, mediator which are actually really good. BPEL and BPMN tuning tips are already available as part of the performance guides/blogs ,but the authors have captured that as well in this book, which is good in one way so as it helps to bring all the performance tuning options together. Monitoring SOA suite, JVM Garbage collections, Platform tuning are very well covered in the book.  It was good to learn we could leverage multiple available options mentioned in the book  to monitor/troubleshoot different JVM/server issues.

          The book also covers the tuning aspects from process perspective as well as at environment level with equal importance. I recommend this book as a must read for SOA server Administrators as well as SOA Consultants, this book will help you to get most out of the SOA infrastructure. The book will make an interesting read for those people who love to take it the next level.

Link to the book @ http://bit.ly/12lrajU

Monday, November 12, 2012

DBAdapter workaround for inserting non-ISO date formats


In SOA there will be many projects which will migrate from using db triggers/procedures to transfer data between different databases/systems to using fusion middleware.
One of the main issues that has DB inserts is due to the legacy way in which Date would have been inserted .It may not be following any ISO standards.
DB adapters would be conforming to iso 8601 xs:dateTime format

From Console error snapshot
               *
ERROR at line 1:
ORA-01830: date format picture ends before converting entire input string

<faultType>0</faultType>
<bindingFault>
<part  name="detail">
<detail> Exception Description: The object [27-Jun-2012 7:12:25 ], of class [class java.lang.String], could not be converted to [class java.sql.Timestamp]. Internal Exception: BINDING.JCA-11636 Could Not Convert Timestamp Exception. Unable to convert a string value in the xml to a java.sql.Timestamp. Even though databases accept strings representing timestamps in a variety of formats, the adapter only accepts strings representing them in xml ISO dateTime format. The input value must be in iso 8601 xs:dateTime format, i.e. YYYY-MM-DDTHH:MM:SS.sss-07:00 </detail>

Solution
1.    Use a custom SQL for insert instead of using Out of the box Insert query.
Since the format that we want in tables are non-ISO format, use TO_DATE function in the custom query with the format - TO_DATE(#DATE_VALUE,'DD-Mon-YYYY HH24:MI:SS'),.


Eg: INSERT INTO LOAD (shipment_id, transaction_id, action_code, create_timestamp, update_timestamp, e1_release_start_date,  e1_release_end_date)    VALUES (#E0Z58SHPID, #E0Z58TRNID, #E0ACTI, TO_DATE(#SSTM,'DD-Mon-YYYY HH24:MI:SS'), TO_DATE(#SSUTM,'DD-Mon-YYYY HH24:MI:SS'),)


2.    Check your XSD element types. Change datetime to string.

      <xs:element name="SSUTM" type="xs:datetime" nillable="true"/>
         <xs:element name="SSUID" type="xs:datetime" nillable="true"/>
to
      <xs:element name="SSUTM" type="xs:string" nillable="true"/>
         <xs:element name="SSUID" type="xs:string" nillable="true"/>

That’s it, now you should be able to insert the records propeprly into legacy databases in date formats not supported by the DB adapter.