2009/1/14 mta38 <mtaraud....@orange-ftgroup.com>: > > Thanks Ibsen and Willem for your answer, > I already try PollingConsumer class, but it does not correspond to my > problem. > Really, I want that a client send a request (with a correlation ID 10 for > example) and block until it receives a response with the same correlation > ID, such as a selector in JMS. > In other words, Is Jms component is the only which permit to use selector?
BTW using a selector to implement request/response is pretty sub-optimal; since it typically means you're gonna be creating/closing a consumer for each message you send; which involves lots of chattiness with the broker. More background and detail here - it also describes how the JMS endpoint in camel implements efficient request-reponse. http://activemq.apache.org/how-should-i-implement-request-response-with-jms.html Basically a single temporary queue is used to send all the replies to the same JVM as made the request; then a multiplexer uses the correlationID of returned messages to pass it to the correct thread. If we want to mimic this behaviour on other transports, I'd suggest doing something similar (without selectors). e.g. telling the server to respond to an endpoint within the JVM of the client (preferably the thread too if possible) - then have an optional multiplexer that matches the replies to the right requesting thread. I'm sure we could refactor the request-reply code in the JMS endpoint (particularly the code which adds a unique correlation ID and maintains the request Future Map of IDs so when a reply comes back we know which thread to wake up etc). For example we could use a single MINA/HTTP/XMPP endpoint consuming all replies for any thread - then use a multiplexer to map which response goes to which thread thats blocked (as you could do concurrent request/replies in different threads). -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/