Wednesday, January 11, 2012

Reliable SOAP over http in Oracle OSB: Point-to-Point Channel

This blog discuss how to implement Point-to-Point (one producer, one consumer) channel in Oracle OSB. This channel is reliable, i.e. it implements:
durable subscriber: to avoid missing messages when the consumer is not listening (e.g. disconnect for maintenance)
guarantee delivery: to make sure that all messages are delivered even when the consumer fail
idempotent receiver: dealing with duplicate messages (receive no duplicate messages)
We use SOAP with WSDL since it's a good practice to define your interfaces with WSDL. We use http since in our existing system we use a lot of RPI-style web services over http.



How:
1. build a jms producer business service (BS): SOAP based on the jmssimple.wsdl (downloadable below)
transport tab: jms protocol and the queue address (please read my other blog about how to setup jms resources in Weblogic)
jms transport tab: queue type, message type: text... handy for test since it's readable,no response
2. build a jms consumer proxy: SOAP also based on the jmssimple.wsdl,
transport tab: jms protocol and the queue address (same as the address in the BS),
jms transport tab: queue type and message type: text, durable susbcription, XA enable
message handling tab: enable transaction & same transaction response. The transaction will rollback (i.e. put the message back to the queue) in case if a fail consumer, thus this enables guarantee delivery.
3. wrap the producer BS with a proxy: SOAP with a wsdl, http transport.
Add a routing options in the request routing in the proxy message flow, enable the Quality of Service in this option.
4. make a consumer BS point to other webservice (e.g. a FileWriter in my example.)



Test:
1. Send a http message (e.g. using SOAPUI) to the producer proxy, the FileWriter service will write a file containing the message from the consumer BS.
2. Disable the FileWriter service
3. Send a http message to the producer proxy again.
4. After awhile turn on the FileWriter service service again, this service will catch up with the messages he missed and write these in the files.

Logging
You can watch the jms message in the jms log files: /servers / /logs/ jmsServers/ . By default the jms logging is off, so you may need to turn on the jms logging (console: JMS resource > Configuration > Logging tab.)

Retrial
You can define also how many times OSB will retry to deliver the messages and define a retrial time out. You may define also an error-channel queue to contain your undelivered messages (after fail retrial attempts.)

Please download the example here(osb 11.1.3 config export).

Using Oracle OSB is an easy way to learn SOA (click here there and voila... your SOA solution is ready.) In the future I will discuss how to implement this using open source ActiveMQ & Spring framework.




See also blogs compilation about messaging for integration: http://soa-java.blogspot.nl/2012/01/asynchronous-messaging-for-integration.html


Please share comment.

Source: Steve's blog http://soa-java.blogspot.com

References
http://eaipatterns.com/
Hohpe's Enterprise Integration Patterns... one of the most popular SOA books in the market


The Definitive Guide to SOA: Oracle Service Bus

No comments: