database operation with nested transaction handling
TRANSCRIPT
DATABASE OPERATION WITH NESTED TRANSACTION HANDLING - WITH MULESOFT
Ashwin A Poojary
Transaction Handling with Database•Since maximum of the businesses include
databases, the operation we perform on to it should be very reliable.
•This reliability we can be obtained by using the MuleSoft’s Transactional scope.
Flow Diagram
Components Required to Achieve This..•Poll•Database Connector•FlowVariable•Set Payload•Choice•Transactional•For Each•Logger•Catch Exception Strategy
Description•Poll - It will poll the database for every 30 minutes.•Select data from DB1 - It will select the data from DB1 and passes it to
the message processors.•recordSize - This variable is used to store the size of the
record
•db1Details - This variable is used to store the DB1 details.•Switch based on file size - Choice router is used to route message based on file
size.
•No Records - If the file size is zero, then the this logger will
log the mentioned information.
•Transactional - If the record size greater than zero, then it
will come to Transactional scope.
•Batch insert DB1 details to DB2 - Here we will be doing batch insert to DB2 for
the data we got from DB1.
•Rollback Exception Strategy - If anything gone wrong while batch inserting it
will rollback the transaction.•Log the Exception - It will log the exception.•Set DB1 details - This will set DB1 data as payload.•For Each - It will take the collection input and process it
one by one.
•Inner Transactional - Used to handle single insertion.•Single insert DB1 details to DB2 - Here we will be doing single insertion to DB2.•Catch Exception Strategy - If anything gone wrong it will be handled by
this.