Reliable asynchronous web-services with Apache CXF

23 downloads 187 Views 298KB Size Report
Reliable asynchronous web-services with Apache CXF. New CXF transport allowing reliable Web Services based on JMS transport and JTA transaction.
Reliable asynchronous web-services with Apache CXF Florent Benoit, BULL/OW2 [ @florentbenoit ] Guy Vachet, France Telecom [[email protected]]

New CXF transport allowing reliable Web Services based on JMS transport and JTA transaction.

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

#1

Context / History

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

#2

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! OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

#3

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) OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

#4

Limitations of the async. CXF proposal ●

Current proposal on Apache side for asynchronous transport seems to present some limitations: ●

One thread per request –



Memory-based mechanism –



recovery after crash?

No transaction support –



scalability?

message sending/receiving

Our objective: define an alternative solution ●

respecting our objectives and context



to be integrated smoothly in CXF OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

#5

A new proposal

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

#6

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 OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

#7

Global architecture view

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

#8

Handling errors [1/2]

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

#9

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 OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

# 10

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

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

# 11

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)

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

# 12

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 OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

# 13

Demo

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

# 14

Demo use-case [1/2]

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

# 15

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

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

# 16

Conclusion

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

# 17

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

OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

# 18

Q&A

Florent Benoit, BULL/OW2 [ @florentbenoit ] Guy Vachet, France Telecom OW2 Annual Conference 2010, November 24-25, La Cantine, Paris. www.ow2.org.

# 19