aspose file tools*
The moose likes Websphere and the fly likes Synchronous processing - Challenge Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Synchronous processing - Challenge" Watch "Synchronous processing - Challenge" New topic
Author

Synchronous processing - Challenge

Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626


We have a typical requirement. And I am scratching my hair for the solution

Application 1- Client Application
Application 2- Our Application
Application 3 -Source Application

1. Application 1 makes web service call to application 2. This is a synchronous call so application 1 is waiting for the reply.
2. From application 2 we have to make a web service call to the application 3 to get the reply back. This is a asynchronous call as reply will come through JMS Q.
3. The application 3 does processing and reply back in JMS Q.
4. Application 2 consumes the response does processing and send response back to application 1. Now the synchronous call gets over.

Best solution is to create thread in application 2 and put it in the wait mode until application 3 replies. But our WAS 7 servers are in the cluster mode so we don't know which server will consume message from JMS Q.
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 445
Your problem is very interesting indeed. One option could be to store the response from JMS Q in database. The thread can poll the database for the response and respond back to Application 1.

This model will work because the database will work as the central place between the cluster members.

However in this thread based model you will eating up the CPU time in your application.

A simplified model could be that you make application 2 also asynchronous and implement a callback webservice at application 1 level.

So when ever application 2 gets the response, it calls something on application 1. This will optimize the CPU usage.
Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626

Deepak,
Thanks for replying. The database option is always there but that is not we are looking at this time.
I do like to know more about the call back web service. If you can point me to location where I can explore further.

Also as an antoher thought I exploring option to use SFSB though not sure how efficient it is.

-Jignesh

Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 445
Here is what I was trying to suggest:

1. "Application 1 - Client Application" will make web service call to Application 2.

2. "Application 1 - Client Application" will host a web service which will be called by Application 2. All the response elements expected by Application 1 should be present in the inbound XML.

3. Application 2 listens to JMS queue and then it calls Application 1 web service.

4. Application 1 acts as a web service client while calling application 2.

5. Application 2 acts as a web service client while passing the JMS information back to application 1.

We have implemented this feature in one of our applications and it works fine. Think of it as application 1 exposing a web service that acts a call back handler.
Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626

Thanks again Deepak

Your suggestion really makes sense. Only problem we do have here, is the calling application(Application 1) can be more then one and in that case we have to deploy
callback service on all the client applications.
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 445
you are correct you will need some receiving web service for each of the client apps that are like application 1 level. But it saves you CPU cycles, threading and flexibility of having different implementations at each of the client level.

Sometimes I think that this is the price we pay by introducing distributed components, which are all intended to be on the same box (may be different processes). So much overhead code for handling simple inter process communication data exchange.
Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626

Thanks again Deepak,

I am starting another thread to understand JMS Q in clustered environment.
But in the continuation of this question, Are you aware about spring has something called Synchronous JMS processing by overriding receive method.
That method will time out if message doesn't come back in specific time frame from the JMS Q. I can use that method for synchronous processing. But not sure how will it behave in the cluster aware environment.

Another question I have is there anything we can do for the managing the work flow through code using Spring 3(not through BPM engine)? As to complete one request I might need to call multiple web services and 1-2 of them reply through JMS Q.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Synchronous processing - Challenge