2. 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.
4. Components Required to Achieve
This..
• Poll
• Database Connector
• FlowVariable
• Set Payload
• Choice
• Transactional
• For Each
• Logger
• Catch Exception Strategy
5. 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
6. • 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.
7. • No Records
- If the file size is zero, then the this logger will log the
mentioned information.
8. • Transactional
- If the record size greater than zero, then it will come to
Transactional scope.
9. • Batch insert DB1 details to DB2
- Here we will be doing batch insert to DB2 for the data
we got from DB1.
10. • 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.
11. • 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.