File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Create sync flow with retry mechanism in the middle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Create sync flow with retry mechanism in the middle" Watch "Create sync flow with retry mechanism in the middle" New topic
Author

Create sync flow with retry mechanism in the middle

ray frid
Ranch Hand

Joined: Dec 23, 2010
Posts: 79
am using Jboss5.1, EJB3.0.

I am developing Webservice.

Each request I am receiving thru this webservice supposed to be procceed and added to another resource(thru another webservice which I will use). that resource sends back a synchronous answer.

Sometimes the webservice which I will use to pass the request could lose connection.

I want to create retry mechanism to ensure after 3 retries I will return a connection failure status.

As we know as soon as I use JMS I lose the synchronous. this flow must be kept synchronized from the beginning.

I know I can implement retry myself. But I would like to use JMS because it's being managed by the container and has more abilities.

Any idea how could I solve this problem?

thanks,

ray.
Andrew Moko
Ranch Hand

Joined: Dec 16, 2011
Posts: 55
I would create a MessageConsumer object from a TemporaryQueue and listen for reply messages.
ray frid
Ranch Hand

Joined: Dec 23, 2010
Posts: 79
Hi Andrew,
Could you give me please more details of your solution?
Andrew Moko
Ranch Hand

Joined: Dec 16, 2011
Posts: 55
ray frid wrote:Hi Andrew,
Could you give me please more details of your solution?


Here's a simple code to get you going.



In this case, dependending on the 'reply', you can choose to resend the message back to the queue or just continue with the proceeding code..

Good luck!
ray frid
Ranch Hand

Joined: Dec 23, 2010
Posts: 79
And it will still keep the whole flow synchronous ?
Andrew Moko
Ranch Hand

Joined: Dec 16, 2011
Posts: 55
Here's a good read http://www.coderanch.com/t/154978/java-Architect-SCEA/certification/JMS-Synchronous-Messaging
 
jQuery in Action, 2nd edition
 
subject: Create sync flow with retry mechanism in the middle
 
Similar Threads
identifying the retry request
Using JMS for Synchronous Messaging
Synchronous processing - Challenge
Create custom properties for JMS Queue
Connectivity to External System