0
Why I Love T                             (And Why You Will Too)                                                 Ben Browni...
Ben Browning•TorqueBox Core Contributor•Red Hat Senior Engineer•Writes Java So You Don’t Have To•@bbrowning
TorqueBox Team
What Is TorqueBox?
What Is TorqueBox?        +
TorqueBox Application ServerSinatra      Rails      Rack            Tasks   Procs            Jobs        Daemons      Web ...
TorqueBox AS•applications & Rack Rails, Sinatra,
TorqueBox AS•applications & Rack Rails, Sinatra,•More than just web •Messaging •Jobs •Services •Caching
TorqueBox ASNo XML and no Java
TorqueBox ASNo XML and no Java (unless youwant to)
TorqueBox Versions•JBoss AS6 Releases based on 1.x Stable•on JBoss AS7 Releases based 2.x Incremental•We’ll concentrate on...
Installation & Usagegem install torquebox-server*torquebox deploy ~/my_ruby_apptorquebox run*http://bit.ly/tb_gem
Develop As UsualEdit your application code,refresh your browser, and seeyour changes reflected.
The UnusualWhat Makes TorqueBox Different?
Backgroundable
Regular Classclass Something def foo end def bar endend
Blocking Invocationssomething = Something.newsomething.foosomething.bar
Backgroundableclass Something include TorqueBox::Messaging::Backgroundable def foo end def bar endend
Non-Blocking Invocationssomething = Something.newsomething.background.foosomething.background.bar
See The Futuresomething = Something.newfuture = something.background.foo
See The Futurefuture.started?future.complete?future.error?future.result
See The Futureclass Something def foo  ...  count += 1  future.status = count  ... endend
See The Future# on the client sidefuture.status_changed?future.status # => 42
Messaging
Message Processorsapp/models/print_handler.rbinclude TorqueBox::Messagingclass PrintHandler < MessageProcessor  def on_mes...
Message Processorsconfig/torquebox.ymlmessaging:  /queues/receipts:    PrintHandler:      concurrency: 5
Scheduled Jobs
Scheduled Jobsapp/jobs/newsletter_sender.rbclass NewsletterSender   def run()    subscriptions = Subscription.find(:all)   ...
Scheduled Jobsconfig/torquebox.ymljobs:  monthly_newsletter:   description: first of month   job: NewsletterSender   cron: ...
Services
Servicesapp/services/time_machine.rbclass TimeMachine def initialize(opts)   @queue = Queue.new(opts[queue]) end def start...
Servicesapp/services/time_machine.rbclass TimeMachine def run  until @done   @queue.publish(Time.now)   sleep(1)  end endend
Servicesconfig/torquebox.ymlservices: TimeMachine:  queue: /queue/morris_day
Caching
Rails Caching config/application.rbmodule MyApp class Application < Rails::Application  ...  config.cache_store = :torque_b...
Explicit Cachinginclude ActiveSupport::CachemyCache =  TorqueBoxStore.new(:name => MyCache,                     :mode => :...
Why I Love TorqueBox
Batteries Included
Clusteringtorquebox run --clustered
Better Java Integration•side Java and Ruby side-by- Deploy•Java and Ruby applications Shared web sessions between•CDI, obj...
Why You’ll Love TorqueBox
OpenThe entire TorqueBox communityis open, not just our code.Get involved and make adifference.
Corporate BackingRed Hat pays a team of developers towork on TorqueBox full-time.Confidence that when the time comes,someo...
Resources•http://torquebox.org•https://github.com/torquebox•#torquebox on FreeNode•@torquebox on Twitter
Questions?                            Don’t Be ShyImage Attributions:Mailboxes - http://www.flickr.com/photos/joanet/50948...
Why I Love TorqueBox (And Why You Will Too)
Why I Love TorqueBox (And Why You Will Too)
Upcoming SlideShare
Loading in...5
×

Why I Love TorqueBox (And Why You Will Too)

10,246

Published on

My TorqueBox presentation from JRubyConf 2011

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
10,246
On Slideshare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
29
Comments
0
Likes
4
Embeds 0
No embeds

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 of "Why I Love TorqueBox (And Why You Will Too)"

    1. 1. Why I Love T (And Why You Will Too) Ben BrowningCreative Commons BY-SA 3.0 JRubyConf 2011
    2. 2. Ben Browning•TorqueBox Core Contributor•Red Hat Senior Engineer•Writes Java So You Don’t Have To•@bbrowning
    3. 3. TorqueBox Team
    4. 4. What Is TorqueBox?
    5. 5. What Is TorqueBox? +
    6. 6. TorqueBox Application ServerSinatra Rails Rack Tasks Procs Jobs Daemons Web Messaging Scheduling Services JBoss AS Clustering Load Balancing HA
    7. 7. TorqueBox AS•applications & Rack Rails, Sinatra,
    8. 8. TorqueBox AS•applications & Rack Rails, Sinatra,•More than just web •Messaging •Jobs •Services •Caching
    9. 9. TorqueBox ASNo XML and no Java
    10. 10. TorqueBox ASNo XML and no Java (unless youwant to)
    11. 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. 12. Installation & Usagegem install torquebox-server*torquebox deploy ~/my_ruby_apptorquebox run*http://bit.ly/tb_gem
    13. 13. Develop As UsualEdit your application code,refresh your browser, and seeyour changes reflected.
    14. 14. The UnusualWhat Makes TorqueBox Different?
    15. 15. Backgroundable
    16. 16. Regular Classclass Something def foo end def bar endend
    17. 17. Blocking Invocationssomething = Something.newsomething.foosomething.bar
    18. 18. Backgroundableclass Something include TorqueBox::Messaging::Backgroundable def foo end def bar endend
    19. 19. Non-Blocking Invocationssomething = Something.newsomething.background.foosomething.background.bar
    20. 20. See The Futuresomething = Something.newfuture = something.background.foo
    21. 21. See The Futurefuture.started?future.complete?future.error?future.result
    22. 22. See The Futureclass Something def foo ... count += 1 future.status = count ... endend
    23. 23. See The Future# on the client sidefuture.status_changed?future.status # => 42
    24. 24. Messaging
    25. 25. Message Processorsapp/models/print_handler.rbinclude TorqueBox::Messagingclass PrintHandler < MessageProcessor  def on_message(body)    puts "Processing #{body} of #{message}"  endend
    26. 26. Message Processorsconfig/torquebox.ymlmessaging: /queues/receipts: PrintHandler: concurrency: 5
    27. 27. Scheduled Jobs
    28. 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. 29. Scheduled Jobsconfig/torquebox.ymljobs: monthly_newsletter: description: first of month job: NewsletterSender cron: ‘0 0 0 1 * ?’
    30. 30. Services
    31. 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. 32. Servicesapp/services/time_machine.rbclass TimeMachine def run until @done @queue.publish(Time.now) sleep(1) end endend
    33. 33. Servicesconfig/torquebox.ymlservices: TimeMachine: queue: /queue/morris_day
    34. 34. Caching
    35. 35. Rails Caching config/application.rbmodule MyApp class Application < Rails::Application ... config.cache_store = :torque_box_store endend
    36. 36. Explicit Cachinginclude ActiveSupport::CachemyCache = TorqueBoxStore.new(:name => MyCache, :mode => :replicated, :sync => true)
    37. 37. Why I Love TorqueBox
    38. 38. Batteries Included
    39. 39. Clusteringtorquebox run --clustered
    40. 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. 41. Why You’ll Love TorqueBox
    42. 42. OpenThe entire TorqueBox communityis open, not just our code.Get involved and make adifference.
    43. 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. 44. Resources•http://torquebox.org•https://github.com/torquebox•#torquebox on FreeNode•@torquebox on Twitter
    45. 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/
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×