The document discusses a new proposal for implementing reliable asynchronous web services with Apache CXF using a JMS transport and JTA transactions. The proposal uses message-driven beans instead of simple JMS message listeners to provide transaction support and handle requests with a pool of objects. This allows reliable message delivery with guaranteed processing even if servers crash. The new transport has been implemented and is available on the OW2 JOnAS server to integrate with CXF and provide asynchronous, reliable web services.
Reliable asynchronous web-services with Apache CXF
1. # 1
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Reliable asynchronous web-services
with Apache CXF
New CXF transport allowing reliable Web Services based on JMS
transport and JTA transaction.
Florent Benoit, BULL/OW2 [ @florentbenoit ]
Guy Vachet, France Telecom [guy.vachet@orange-ftgroup.com]
2. # 2
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Context / History
3. # 3
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
France Telecom Orange context
● Large heterogeneous IS
● Over 3000 interconnected applications
● Since 2006, generalized web services usage with SOAP over HTTP,
in order to:
– standardize exchanges between applications
– create facades between the front end and the legacy back-office
● SOAP over HTTP drawbacks
● Tightly-coupled transport
● Services inaccessible when the provider is inactive
● Difficulty to analyze failures (404-type errors)
● Long-lasting back office operations unadapted to real-time front-end
interactions: we need asynchronism!
4. # 4
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
SOAP over JMS proposal
● Objectives
● Real asynchronous client-server exchange
● Guarantee the reliability of message delivery (no message loss,
no duplicate)
● JTA Transactional features
– client-side: between its resources and the message sent
– server-side: between message reading and its resources
– similarly for responses
● Technical context
● WSDL first
● Based on CXF2.1
● Standard Java EE context: JOnAS (Java EE) and JORAM (JMS)
5. # 5
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Limitations of the async. CXF proposal
● Current proposal on Apache side for asynchronous transport
seems to present some limitations:
● One thread per request
– scalability?
● Memory-based mechanism
– recovery after crash?
● No transaction support
– message sending/receiving
●
Our objective: define an alternative solution
● respecting our objectives and context
● to be integrated smoothly in CXF
6. # 6
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
A new proposal
7. # 7
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Content of the new Proposal
● Based on Apache CXF
● Use benefits of EJB Message Driven Bean instead of
simple « JMS Message Listener»
● JTA Transaction support (Java EE standard)
● Use of a pool of objects for handling requests
● New CXF Transport: named MDB (url = mdb://)
● Based on some parts of the CXF/JMS library (used for some
functions like building a JMS message from a CXF message)
● 3 parts
● Client: sending and receiving
● Server: endpoint
8. # 8
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Global architecture view
9. # 9
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Handling errors [1/2]
10. # 10
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Handling errors [2/2]
● If there is a failure when a Message Driven Bean is
handling a JMS message, new attempts to redeliver the
message will occur (one retry for each failure as per JMS
specification)
● For each failure:
– Transaction rollback
● All database operations (or involving other XA resources)
are canceled
● Upon reaching a specified number of repetitive failures:
→ Sending the fault message to a « Dead Message Queue »
● JMS Persistent messages
● When we restart servers, all persisted messages will be delivered
– No message loss
11. # 11
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Prerequisites
● Java EE server: (Tested with JOnAS 5.2.0 M3)
● Java EE 5 application server with EJB 3.1 Singleton bean
support
● Java EE 6 App server
● JMS server (Tested with JOnAS/JORAM)
● Spring is used for the Transport configuration
● Spring already used by CXF
12. # 12
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Availability [1/2]
● Code hosted on OW2 JOnAS forge
● JOnAS subproject:
– Own life-cycle following CXF releases
● Module available through the OW2 maven
repository (and Maven Central repository)
● Metrics
● 2 interfaces (AsyncHandler and ContextInfo)
● 10 new classes
● ≈ 1500 Lines of code (without examples / tests)
13. # 13
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Availability [2/2]
● Easy to plug:
→ Add a new MDB CXF transport = Adding MDB
transport jar as library in the class-path
● Integrated with:
● CXF 2.2.x (2.2.11)
● CXF 2.3.x (2.3.0)
● Available by default on JOnAS application
server (nothing to do) → JOnAS 5.2.0 M4
SNAPSHOT
● Wish to contribute back this transport to the
Apache CXF community
14. # 14
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Demo
15. # 15
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Demo use-case [1/2]
16. # 16
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Demo use-case [2/2]
● One server with JMS
● JOnAS hosting all JMS Queues (« endpoint »
queue and «client answer» queue
● JMS server used is JORAM
● 3 JOnAS servers
– JOnAS 1: Sending messages from a client
– JOnAS 2: WS Endpoint
– JOnAS 3: Handling response on the client side
● Crash recovery demo for servers JOnAS2 and
JOnAS3
17. # 17
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Conclusion
18. # 18
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Conclusion
● France Telecom Orange started to use this transport.
● Some projects are experimenting this.
● Global idea is to contribute back this MDB protocol to
Apache CXF community
● Available on
http://wiki.jonas.ow2.org/xwiki/bin/view/Main/MDB_Transport_CXF
19. # 19
OW2 Annual Conference 2010, November 24-25, La Cantine, Paris.
www.ow2.org.
Q & A
Florent Benoit, BULL/OW2 [ @florentbenoit ]
Guy Vachet, France Telecom