• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connecting to external systems

 
Tomi Tuomainen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Supposing there's a system that has a business service BS which connects to an external system ES to perform an operation. BS has to wait for the answer from ES and send asynchronous message after that. I don't want BS to block my client since ES execution could take some time and the response will be anyway asynchronous. How should I handle this?

We must create a thread for ES call so that it won't block the client, right? Because it's not allowed to create threads in EJB tier the only place to start this thread would be client? Is it legal to start a thread like this from a servlet?

Tomi
 
Parag Doshi
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tomi Tuomainen:
Supposing there's a system that has a business service BS which connects to an external system ES to perform an operation. BS has to wait for the answer from ES and send asynchronous message after that. I don't want BS to block my client since ES execution could take some time and the response will be anyway asynchronous. How should I handle this?

We must create a thread for ES call so that it won't block the client, right? Because it's not allowed to create threads in EJB tier the only place to start this thread would be client? Is it legal to start a thread like this from a servlet?

Tomi


Tomi,
There are quite a few ways to go about this. You can start threads from your servlet. I dont think there is any problems with that. Although, normally, you would rather do this at the business delegate level. It can start a thread, which will do what you need to do. This way, it will be handled cleanly. Ofcourse, you have to make sure that your business delegate isnt a session bean
Also make sure that your application is manageable, because if you start too many threads (one per each request for performing operation from ES), then you have to look at your resource comsumption, its affect on performance (if any), any shared resources which might be accessed by multiple threads etc.

Then there is always JMS

Hope this helps.

Parag
 
Tomi Tuomainen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Parag. That confirmed my assumptions.

Tomi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic