hi friends excuse me if i am posting a basic qustion, but please reply answer or hint...
i am working on flight booking system. So we request for specific flight ticket to our vendor. we send XML request to vendor. After that vendor do requested processing and save necessary changes in there database in vendor database. vendor not send any response to our side. here booking task completed. Now we need to know status of that booking requested that will change from pending to success on vendor database. We have to fetch that by making XML request for ticket status to vendor.
But problem here is, after flight booking i need to show my website visitor the status of booking request and status will change on vendor server within 2 to 30 minutes.
So is it possible that i can call one function from my java program and send response page to web site user and that function will keep running in background on my server 6 times with interval of 5 minutes. So when status change i can store that in my server database.
i did some home work on this, and i know that i can use thread and keep them sleep for 5 minutes with max 6 times until i got response. but can anybody suggest me how i create such process calling from my java program that will keep working in background on server.
One good way is to have the vendor call you back when a processing is completed. You can have anything like a Rest service, xml web service, simple servlet, etc. waiting for your vendor to call to report a completed processing.
Joined: Aug 08, 2012
Thanks for your response Kathleen Angeles,
I know what your saying, but this vendor not sending us any report he just set changes in his own database, and we have to make status request again to take fetch that status.
If you need to do this in a loop the best thing to do is figure out how to do it once. That is the tough part. Once you know how to do it once, write a loop. Take into consideration on how to stop, when to sleep, and when you could/should skip sleeping. Once you can do it in a loop in a manner that functions appropriately it is trivial to make it work in a Thread. But you might consider other options than using a thread for each customer. But don't jump ahead with those concerns until you can get your single request working and your loop of requests working.
Joined: Aug 08, 2012
Steve Luke thanks for your replay.
I done this, i use thread concept for this. i create new thread and call that function. So that thread will keep running on server until he get response from vendor server. and after getting response, its done necessary changes in our server database.