I need to accept a request and then query two systems. I need to send
off the first query to a queue then execute the second query. After
getting the result from the second query I need to wait for a response
from the first query via an MDB before combining the data from both
queries and returning a response.
Of course the first thing about EJBs is that you can't muck around
waiting and notifying threads so how can I do this.
Options
Some JBoss specific classes that are safe to use. But I'll want to
move to WebSphere next year.
Implement this as a separate stand-alone non-J2EE server.
Use some J2EE API designed for this purpose. Am I missing this?
> I need to accept a request and then query two systems. I need to
> send off the first query to a queue then execute the second query.
[quoted text clipped - 13 lines]
>
> Use some J2EE API designed for this purpose. Am I missing this?
Put the result from the second query into a buffer and pick it up when
your MDB is triggered by the result of the first query.
The buffer could be anything from a singleton to a database table,
depending on lots of things that I don't know anything about :-) Anyway,
I don't think you have to write stuff that breaks portability and the
J2EE standard to achieve this. Just make sure the buffer won't become a
bottleneck.

Signature
jon martin solaas
_ - 12 Oct 2005 20:40 GMT
Thanks for the suggestion Jon. One of my main objectives is to devise
a solution that works inside the J2EE container. Your solution does
work for a setup where a client is sending queries and concurrently
listening for responses to past queries. Unfortunately I also have the
situation where the initial request thread is fired up by an HTTP
request and so needs to wind up by building a response and returning
that to the browser. I also don't know which query will finish first.
Any ideas?
>> I need to accept a request and then query two systems. I need to
>> send off the first query to a queue then execute the second query.
[quoted text clipped - 22 lines]
> J2EE standard to achieve this. Just make sure the buffer won't become a
> bottleneck.