Recently I worked on a integration project threw read-timeout exception and blocking web service call. The client calls a EJB web service method to persistent an Entity Bean. Unfortunately this web service is implemented wihtin a long-running process and it causes JBoss transaction timeout.
The exception like this

This bug looks like easy, and I can just raise the JBoss’s jboss-service.xml Transaction Timeout value to higher.
But if you look down the details, you may find more interesting thing. Read more on Transaction Timeouts and EJB3/JPA and Using JBossJTA in Application Servers.

Although this might fix my problem of tansaction timeout, I still haven’t solved the performance issue from client calling the long-running process. Then I change the code inside of EJB web service. I crate a Message Driven Bean (MDB) and move the persistent Entity Bean there. Now the exposed web service method sends JMS message to MDB asynchronously and return to client fast. No more blocking web service call.

Reference:

Building a JMS Web service using SOAP over JMS and WebSphere Studio

pic0914

Advertisements