Thursday, February 7, 2013

Oracle Service Bus 11gR1:Global Transaction

Traditionally there are two choices for transaction management: global or local transactions. Global transactions are managed by the application server, using the Java Transaction API (JTA). Local transactions are resource-specific: the most common example would be a transaction associated with a JDBC connection. This choice has profound implications. For instance, global transactions provide the ability to work with multiple transactional resources (typically relational databases and message queues). With local transactions, the application server is not involved in transaction management and cannot help ensure correctness across multiple resources. (It is worth noting that most applications use a single transaction resource.)
This blog I’m going to show you how the global transaction can be controlled with Oracle Service Bus. 
Scenario: JMS Queue and Database are two participants in the transaction. A proxy service reads a message from an Inbound Queue, publishes it on to an Outbound Queue and the same message is INSERTED into Oracle Database Table, TRAIN.

The expected behavior of the scenario is either two (Queue & TRAIN) or none gets the message.

 Steps: 1. Create an InboundQueue and an OutboundQueue

 


  












2. Make sure Delivery Failure settings are as below:




















3. Create a DbAdapter in JDeveloper and import those artifacts into OSB project.

 











4. Create a proxy service which reads the message from InboundQueue, publishes to OutboundQueue and INSERT into TRAIN.

 



5. Add Routing Options to both Publish and Routing and set property of QoS as 'Exactly Once'.





6. Make sure 'Transaction Required' property is checked in proxy service Message Handling Configuration


7. You can create a Raise Error activity after publish activity or in response pipeline to validate this scenario. You can notice the behaviour. 

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi,I have a service which is atomic transaction, So when we are invoking atomic transactional service over proxy service, we are getting the error "Transaction context is required", As for same we added policy file of AT in business and proxy service but again we are getting same error.
    please help me

    ReplyDelete
  3. Hi Sandeep,

    Please let me know whether the issue has got fixed and how?

    ReplyDelete