CRUDActivities.bwp

This process demonstrates how to use the plug-in to implement transactions for CRUD operations.Activities are added to the Local Transaction Group. Configuration is mentioned in the section MongoDB Transactions. The process demonstrates two scenarios:
  • In the first Local Transaction Group, CRUD activities participate in a transaction and the transaction is committed successfully.
  • In the second Local Transaction Group, three InsertDocument activities participate in a transaction but the transaction is aborted due to an exception thrown from within the transaction group.
The process is designed with the following activities:

The following table describes the activities in the process.

Activity Description
RemoveDocument Removes all the documents in the specified collection.
InsertDocument This activity inserts a document in the specified collection that is used by activities inside local transaction group. Specified collection is created if it does not exist. This activity is used because transactions work only on existing collections.
InsertDocument1 This is the first activity inside a transaction. Transaction starts with a session that is used for all the activities that share the same connection resource. WriteConcern selected for this activity is used for the whole transaction irrespective of the selected write concerns of individual activities in the group. This activity inserts a document in the specified collection using the session.
UpdateDocument Updates the inserted document with a field in the specified collection using the session.
QueryDocument Queries the inserted document in the specified collection using the session.
RemoveDocument Removes the documents inserted in the specified collection using the session.
InsertDocument2 This activity does not participate in the transaction as the Override Transaction behavior is selected in the Advance tab. Document is inserted though the transaction fails.
InsertDocument3 This is the first activity inside a transaction. This activity tries to insert a document in to the collection but as transaction is failed the changes are rolled back.
InsertDocument4 Duplicate ID insertion in this activity gives an exception. The transaction aborts with no changes committing to database. ContinueonError has no effect on transaction.