Sha256: 7bc046cb8759fa400403191486e905a78a950463ae11ba9b1bea35b0d4440773
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
# # HornetQ Consumer: # Reply to a request # # Allow examples to be run in-place without requiring a gem install $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' require 'rubygems' require 'yaml' require 'hornetq' timeout = (ARGV[0] || 60000).to_i config = YAML.load_file(File.dirname(__FILE__) + '/hornetq.yml')['development'] # Create a HornetQ session HornetQClient::Factory.create_session(config) do |session| server = session.create_server('jms.queue.ExampleQueue', timeout) session.start count = 0 start_time = Time.now server.run do |request_message| count = count + 1 #puts "==================================" text = request_message.body #p text #p request_message #print "." puts "#{count}" if count%1000 == 0 puts "Durable" if request_message.durable reply_message = session.create_message(HornetQClient::Message::TEXT_TYPE, false) reply_message << "Test Response" reply_message end duration = Time.now - start_time - timeout/1000 puts "\nReceived #{count} requests in #{duration} seconds at #{count/duration} messages per second" server.close end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jruby-hornetq-0.2.0.alpha | examples/server.rb |