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

Why I Love TorqueBox (And Why You Will Too)

on

  • 9,315 views

My TorqueBox presentation from JRubyConf 2011

My TorqueBox presentation from JRubyConf 2011

Statistics

Views

Total Views
9,315
Views on SlideShare
2,774
Embed Views
6,541

Actions

Likes
3
Downloads
28
Comments
0

18 Embeds 6,541

http://torquebox.org 4306
http://thinkingconcurrently.com 1176
http://www.jboss.org 779
http://planet.jboss.org 156
http://lanyrd.com 49
http://abtasty.com 17
http://staging.torquebox.org 15
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
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \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

Why I Love TorqueBox (And Why You Will Too) Why I Love TorqueBox (And Why You Will Too) Presentation Transcript

  • Why I Love T (And Why You Will Too) Ben BrowningCreative Commons BY-SA 3.0 JRubyConf 2011
  • 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 Messaging Scheduling Services JBoss AS Clustering Load Balancing HA
  • 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 2.x
  • 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_message(body)    puts "Processing #{body} of #{message}"  endend
  • Message Processorsconfig/torquebox.ymlmessaging: /queues/receipts: PrintHandler: concurrency: 5
  • Scheduled Jobs
  • Scheduled Jobsapp/jobs/newsletter_sender.rbclass NewsletterSender   def run()    subscriptions = Subscription.find(:all)    subscriptions.each do |e|      send_newsletter(e)    end  end end
  • Scheduled Jobsconfig/torquebox.ymljobs: monthly_newsletter: description: first of month job: NewsletterSender cron: ‘0 0 0 1 * ?’
  • Services
  • 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
  • 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_box_store endend
  • Explicit Cachinginclude ActiveSupport::CachemyCache = TorqueBoxStore.new(:name => MyCache, :mode => :replicated, :sync => true)
  • 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, objectsJava components - Injection of bound to JNDI, etc•consume in Ruby and vice-versa Send JMS messages in Java to
  • 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,someone will be there to help with yourquestions.
  • 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/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/