SlideShare une entreprise Scribd logo
1  sur  47
Why I Love T
                             (And Why You Will Too)




                                                 Ben Browning
Creative 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 Server


Sinatra      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 AS
No XML and no Java
TorqueBox AS
No XML and no Java (unless you
want 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 & Usage
gem install torquebox-server*

torquebox deploy ~/my_ruby_app

torquebox run



*http://bit.ly/tb_gem
Develop As Usual
Edit your application code,
refresh your browser, and see
your changes reflected.
The Unusual
What Makes TorqueBox Different?
Backgroundable
Regular Class

class Something

 def foo
 end

 def bar
 end

end
Blocking Invocations

something = Something.new

something.foo

something.bar
Backgroundable

class Something

 include TorqueBox::Messaging::Backgroundable

 def foo
 end

 def bar
 end

end
Non-Blocking Invocations

something = Something.new

something.background.foo

something.background.bar
See The Future

something = Something.new

future = something.background.foo
See The Future

future.started?

future.complete?

future.error?

future.result
See The Future

class Something

 def foo
  ...
  count += 1
  future.status = count
  ...
 end

end
See The Future

# on the 'client' side

future.status_changed?

future.status # => 42
Messaging
Message Processors
app/models/print_handler.rb

include TorqueBox::Messaging

class PrintHandler < MessageProcessor
  def on_message(body)
    puts "Processing #{body} of #{message}"
  end
end
Message Processors
config/torquebox.yml

messaging:
  /queues/receipts:
    PrintHandler:
      concurrency: 5
Scheduled Jobs
Scheduled Jobs
app/jobs/newsletter_sender.rb

class NewsletterSender
 
  def run()
    subscriptions = Subscription.find(:all)
    subscriptions.each do |e|
      send_newsletter(e)
    end
  end
 
end
Scheduled Jobs
config/torquebox.yml

jobs:
  monthly_newsletter:
   description: first of month
   job: NewsletterSender
   cron: ‘0 0 0 1 * ?’
Services
Services
app/services/time_machine.rb

class TimeMachine
 def initialize(opts)
   @queue = Queue.new(opts['queue'])
 end

 def start
  Thread.new { run }
 end

 def stop
  @done = true
 end
end
Services
app/services/time_machine.rb


class TimeMachine

 def run
  until @done
   @queue.publish(Time.now)
   sleep(1)
  end
 end

end
Services
config/torquebox.yml

services:
 TimeMachine:
  queue: /queue/morris_day
Caching
Rails Caching
 config/application.rb

module MyApp
 class Application < Rails::Application

  ...

  config.cache_store = :torque_box_store

 end
end
Explicit Caching

include ActiveSupport::Cache

myCache =
  TorqueBoxStore.new(:name => 'MyCache',
                     :mode => :replicated,
                     :sync => true)
Why I Love TorqueBox
Batteries Included
Clustering
torquebox 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
Open
The entire TorqueBox community
is open, not just our code.

Get involved and make a
difference.
Corporate Backing
Red Hat pays a team of developers to
work on TorqueBox full-time.


Confidence that when the time comes,
someone will be there to help with your
questions.
Resources
•http://torquebox.org
•https://github.com/torquebox
•#torquebox on FreeNode
•@torquebox on Twitter
Questions?
                            Don’t Be Shy




Image 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/

Contenu connexe

Tendances

Converting LotusScript Agents to Java Agents
Converting LotusScript Agents to Java AgentsConverting LotusScript Agents to Java Agents
Converting LotusScript Agents to Java Agents
dominion
 

Tendances (20)

Gearman
GearmanGearman
Gearman
 
Rails 5 – Amsterdam.rb – Uberous
Rails 5 – Amsterdam.rb – UberousRails 5 – Amsterdam.rb – Uberous
Rails 5 – Amsterdam.rb – Uberous
 
Puppet Camp Tokyo 2014: Why we stopped using Puppet Agent Daemon
Puppet Camp Tokyo 2014: Why we stopped using Puppet Agent Daemon Puppet Camp Tokyo 2014: Why we stopped using Puppet Agent Daemon
Puppet Camp Tokyo 2014: Why we stopped using Puppet Agent Daemon
 
Ruby formatters
Ruby formattersRuby formatters
Ruby formatters
 
Background processes and tasks in an async world
Background processes and tasks in an async worldBackground processes and tasks in an async world
Background processes and tasks in an async world
 
面向引擎——编写高效率JS
面向引擎——编写高效率JS面向引擎——编写高效率JS
面向引擎——编写高效率JS
 
Merb tutorial
Merb tutorialMerb tutorial
Merb tutorial
 
Designing a Docker Stack for Symfony apps: lessons learned
Designing a Docker Stack  for Symfony apps: lessons learnedDesigning a Docker Stack  for Symfony apps: lessons learned
Designing a Docker Stack for Symfony apps: lessons learned
 
A look at FastCgi & Mod_PHP architecture
A look at FastCgi & Mod_PHP architectureA look at FastCgi & Mod_PHP architecture
A look at FastCgi & Mod_PHP architecture
 
Symfony vs. Message Brokers
Symfony  vs.  Message BrokersSymfony  vs.  Message Brokers
Symfony vs. Message Brokers
 
CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011CakePHP 2.0 - PHP Matsuri 2011
CakePHP 2.0 - PHP Matsuri 2011
 
Re-imaginging CakePHP
Re-imaginging CakePHPRe-imaginging CakePHP
Re-imaginging CakePHP
 
Converting LotusScript Agents to Java Agents
Converting LotusScript Agents to Java AgentsConverting LotusScript Agents to Java Agents
Converting LotusScript Agents to Java Agents
 
Automated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and SeleniumAutomated Testing with Cucumber, PhantomJS and Selenium
Automated Testing with Cucumber, PhantomJS and Selenium
 
Cucumber.js: Cuke up your JavaScript!
Cucumber.js: Cuke up your JavaScript!Cucumber.js: Cuke up your JavaScript!
Cucumber.js: Cuke up your JavaScript!
 
HTTP/2 : why upgrading the web? - apidays Paris
HTTP/2 : why upgrading the web? - apidays ParisHTTP/2 : why upgrading the web? - apidays Paris
HTTP/2 : why upgrading the web? - apidays Paris
 
I Promise You
I Promise YouI Promise You
I Promise You
 
Node & Express as Workflow Tools
Node & Express as Workflow ToolsNode & Express as Workflow Tools
Node & Express as Workflow Tools
 
Building Desktop RIAs with JavaScript and PHP - ZendCon09
Building Desktop RIAs with JavaScript and PHP - ZendCon09Building Desktop RIAs with JavaScript and PHP - ZendCon09
Building Desktop RIAs with JavaScript and PHP - ZendCon09
 
High Productivity Web Development Workflow
High Productivity Web Development WorkflowHigh Productivity Web Development Workflow
High Productivity Web Development Workflow
 

Similaire à Why I Love TorqueBox (And Why You Will Too)

Scaling Rails With Torquebox Presented at JUDCon:2011 Boston
Scaling Rails With Torquebox Presented at JUDCon:2011 BostonScaling Rails With Torquebox Presented at JUDCon:2011 Boston
Scaling Rails With Torquebox Presented at JUDCon:2011 Boston
benbrowning
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
tobiascrawley
 
When Two Worlds Collide: Java and Ruby in the Enterprise
When Two Worlds Collide: Java and Ruby in the EnterpriseWhen Two Worlds Collide: Java and Ruby in the Enterprise
When Two Worlds Collide: Java and Ruby in the Enterprise
benbrowning
 

Similaire à Why I Love TorqueBox (And Why You Will Too) (20)

Scaling Rails With Torquebox Presented at JUDCon:2011 Boston
Scaling Rails With Torquebox Presented at JUDCon:2011 BostonScaling Rails With Torquebox Presented at JUDCon:2011 Boston
Scaling Rails With Torquebox Presented at JUDCon:2011 Boston
 
TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
 
When Two Worlds Collide: Java and Ruby in the Enterprise
When Two Worlds Collide: Java and Ruby in the EnterpriseWhen Two Worlds Collide: Java and Ruby in the Enterprise
When Two Worlds Collide: Java and Ruby in the Enterprise
 
Life in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoLife in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with django
 
Torquebox rubyhoedown-2012
Torquebox rubyhoedown-2012Torquebox rubyhoedown-2012
Torquebox rubyhoedown-2012
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
Lessons Learnt in 2009
Lessons Learnt in 2009Lessons Learnt in 2009
Lessons Learnt in 2009
 
Introduction to meteor
Introduction to meteorIntroduction to meteor
Introduction to meteor
 
[AWS Builders] Effective AWS Glue
[AWS Builders] Effective AWS Glue[AWS Builders] Effective AWS Glue
[AWS Builders] Effective AWS Glue
 
Stackato v3
Stackato v3Stackato v3
Stackato v3
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
 
APIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidadAPIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidad
 
SGCE 2015 REST APIs
SGCE 2015 REST APIsSGCE 2015 REST APIs
SGCE 2015 REST APIs
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Devignition 2011
Devignition 2011Devignition 2011
Devignition 2011
 
Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
 
Stackato v4
Stackato v4Stackato v4
Stackato v4
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Why I Love TorqueBox (And Why You Will Too)

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n