Why I Love TorqueBox (And Why You Will Too)
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Why I Love TorqueBox (And Why You Will Too)

  • 9,639 views
Uploaded on

My TorqueBox presentation from JRubyConf 2011

My TorqueBox presentation from JRubyConf 2011

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
9,639
On Slideshare
2,862
From Embeds
6,777
Number of Embeds
18

Actions

Shares
Downloads
28
Comments
0
Likes
3

Embeds 6,777

http://torquebox.org 4,357
http://thinkingconcurrently.com 1,359
http://www.jboss.org 779
http://planet.jboss.org 156
http://lanyrd.com 50
http://abtasty.com 17
http://staging.torquebox.org 16
http://localhost 14
http://localhost:4242 8
http://twitter.com 6
http://www.hanrss.com 5
https://twitter.com 3
http://prlog.ru 2
http://207.46.192.232 1
http://torquebox.dev 1
http://translate.googleusercontent.com 1
http://planet-stg.jboss.org 1
http://www.google.co.uk 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Transcript

  • 1. Why I Love T (And Why You Will Too) Ben BrowningCreative Commons BY-SA 3.0 JRubyConf 2011
  • 2. Ben Browning•TorqueBox Core Contributor•Red Hat Senior Engineer•Writes Java So You Don’t Have To•@bbrowning
  • 3. TorqueBox Team
  • 4. What Is TorqueBox?
  • 5. What Is TorqueBox? +
  • 6. TorqueBox Application ServerSinatra Rails Rack Tasks Procs Jobs Daemons Web Messaging Scheduling Services JBoss AS Clustering Load Balancing HA
  • 7. TorqueBox AS•applications & Rack Rails, Sinatra,
  • 8. TorqueBox AS•applications & Rack Rails, Sinatra,•More than just web •Messaging •Jobs •Services •Caching
  • 9. TorqueBox ASNo XML and no Java
  • 10. TorqueBox ASNo XML and no Java (unless youwant to)
  • 11. TorqueBox Versions•JBoss AS6 Releases based on 1.x Stable•on JBoss AS7 Releases based 2.x Incremental•We’ll concentrate on 2.x
  • 12. Installation & Usagegem install torquebox-server*torquebox deploy ~/my_ruby_apptorquebox run*http://bit.ly/tb_gem
  • 13. Develop As UsualEdit your application code,refresh your browser, and seeyour changes reflected.
  • 14. The UnusualWhat Makes TorqueBox Different?
  • 15. Backgroundable
  • 16. Regular Classclass Something def foo end def bar endend
  • 17. Blocking Invocationssomething = Something.newsomething.foosomething.bar
  • 18. Backgroundableclass Something include TorqueBox::Messaging::Backgroundable def foo end def bar endend
  • 19. Non-Blocking Invocationssomething = Something.newsomething.background.foosomething.background.bar
  • 20. See The Futuresomething = Something.newfuture = something.background.foo
  • 21. See The Futurefuture.started?future.complete?future.error?future.result
  • 22. See The Futureclass Something def foo ... count += 1 future.status = count ... endend
  • 23. See The Future# on the client sidefuture.status_changed?future.status # => 42
  • 24. Messaging
  • 25. Message Processorsapp/models/print_handler.rbinclude TorqueBox::Messagingclass PrintHandler < MessageProcessor  def on_message(body)    puts "Processing #{body} of #{message}"  endend
  • 26. Message Processorsconfig/torquebox.ymlmessaging: /queues/receipts: PrintHandler: concurrency: 5
  • 27. Scheduled Jobs
  • 28. Scheduled Jobsapp/jobs/newsletter_sender.rbclass NewsletterSender   def run()    subscriptions = Subscription.find(:all)    subscriptions.each do |e|      send_newsletter(e)    end  end end
  • 29. Scheduled Jobsconfig/torquebox.ymljobs: monthly_newsletter: description: first of month job: NewsletterSender cron: ‘0 0 0 1 * ?’
  • 30. Services
  • 31. Servicesapp/services/time_machine.rbclass TimeMachine def initialize(opts) @queue = Queue.new(opts[queue]) end def start Thread.new { run } end def stop @done = true endend
  • 32. Servicesapp/services/time_machine.rbclass TimeMachine def run until @done @queue.publish(Time.now) sleep(1) end endend
  • 33. Servicesconfig/torquebox.ymlservices: TimeMachine: queue: /queue/morris_day
  • 34. Caching
  • 35. Rails Caching config/application.rbmodule MyApp class Application < Rails::Application ... config.cache_store = :torque_box_store endend
  • 36. Explicit Cachinginclude ActiveSupport::CachemyCache = TorqueBoxStore.new(:name => MyCache, :mode => :replicated, :sync => true)
  • 37. Why I Love TorqueBox
  • 38. Batteries Included
  • 39. Clusteringtorquebox run --clustered
  • 40. Better Java Integration•side Java and Ruby side-by- Deploy•Java and Ruby applications Shared web sessions between•CDI, objectsJava components - Injection of bound to JNDI, etc•consume in Ruby and vice-versa Send JMS messages in Java to
  • 41. Why You’ll Love TorqueBox
  • 42. OpenThe entire TorqueBox communityis open, not just our code.Get involved and make adifference.
  • 43. Corporate BackingRed Hat pays a team of developers towork on TorqueBox full-time.Confidence that when the time comes,someone will be there to help with yourquestions.
  • 44. Resources•http://torquebox.org•https://github.com/torquebox•#torquebox on FreeNode•@torquebox on Twitter
  • 45. Questions? Don’t Be ShyImage Attributions:Mailboxes - http://www.flickr.com/photos/joanet/5094833752/Now and Laters - http://www.flickr.com/photos/jcorduroy/3725077603/Hand Calendar - http://www.flickr.com/photos/joelanman/366190064/Cruise Ship Staff - http://www.flickr.com/photos/maethlin/2547037443/Self Storage - http://www.flickr.com/photos/64588532@N02/5882291769/