Created
January 8, 2013 19:59
-
-
Save bbrowning/4487368 to your computer and use it in GitHub Desktop.
Example of publishing messages at a high speed with TorqueBox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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