Skip to content

Instantly share code, notes, and snippets.

@imbriaco
Created February 2, 2009 04:30
Show Gist options
  • Save imbriaco/56783 to your computer and use it in GitHub Desktop.
Save imbriaco/56783 to your computer and use it in GitHub Desktop.
#!/usr/bin/env jruby
require 'benchmark'
require 'java'
module RabbitMQ
module RabbitMQ::Client
include_package "com.rabbitmq.client"
end
end
conn = RabbitMQ::Client::ConnectionFactory.new().new_connection('localhost', 5672)
chan = conn.create_channel()
Benchmark.bm do |bench|
bench.report do
100_000.times do |message_number|
chan.basic_publish('amq.topic', 'jruby', nil, "test: #{message_number}".to_java_bytes)
end
end
end
chan.close
conn.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment