Sha256: 78666e755b65b8f00d015aa32e8589eb3614a80eead31cfe0f9a5dc467744163
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 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 HornetQ::Client::Factory.session(config) do |session| server = session.create_server('jms.queue.ExampleQueue', timeout) session.start count = 0 start_time = Time.now puts "Server started and waiting for requests ..." server.run do |request_message| count += 1 print '.' puts "#{count}" if count%1000 == 0 puts "Durable" if request_message.durable reply_message = session.create_message(HornetQ::Client::Message::TEXT_TYPE, false) reply_message.body = "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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jruby-hornetq-0.2.5.alpha | examples/client/advanced/server.rb |
jruby-hornetq-0.2.3.alpha | examples/client/advanced/server.rb |