views:

28

answers:

0
 ---[ejb request]--> bean -----[http request]---->  host

I would like to invoke http client method (http put, get...) within a bean, but I want these beans, either MDB or stateless session bean, run as quick as possible (with extreme short life time).

Problem is, the http connection is too slow (especially when connecting to slow hosts). Take MDB for example, due to http latency, the MDB run too long, and the queue is quickly stalled with continuing coming messages. (Message producer is faster than http method invocation.)

how can I solve such problem?

  1. using NIO http client? would it help?
  2. open extra Threads to execute http invocation? (but running explicit thread in bean is not recommended in JEE)
  3. some async http client? is there any such libs? don't they use Thread?

thanks~