Closed lstanden closed 10 years ago
I managed to get something that functions using the following code:
session.consumer(:destination => destination) do |consumer|
if message = consumer.get(:timeout => 2000)
data = message.data
# etc
end
end
I think the syntax could easily be improved by having a consume_one helper method (or similar). I may submit a patch when I get a few minutes :)
Great idea to create a higher level api to wrap the one time call capability. The following sample works, but does require more coding: https://github.com/reidmorrison/jruby-jms/blob/master/examples/client-server/requestor.rb
Looking forward to the merge request
Hello again :)
I'm trying to work out how best to perform synchronous messaging. After doing some debugging, I've determined that supplying a modest timeout (ie. 2 seconds) will result in execution in the top level code for the full duration. After checking out the code, this makes sense form what I'm seeing there.
Would it be possible to add a feature for consuming exactly one message from the queue and then resuming? This would allow the following workflow, which is commonly in use here.
What I don't want to have is #3 block for the full timeout duration when the message responds immediately. Thanks :)