Skip to content

Instantly share code, notes, and snippets.

@bbrowning
Created January 8, 2013 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbrowning/4487368 to your computer and use it in GitHub Desktop.
Save bbrowning/4487368 to your computer and use it in GitHub Desktop.
Example of publishing messages at a high speed with TorqueBox
queue = TorqueBox::Messaging::Queue.new('/queue/foo')
options = { :startup_timeout => 500, :persistent => false, :tx => false }
normalized_options = queue.normalize_options(options)
queue.wait_for_destination(options[:startup_timeout]) do
queue.with_session(options) do |session|
# loop here and publish each message
5.times { session.publish(queue, Time.now.to_s, normalized_options) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment