Skip to content

Instantly share code, notes, and snippets.

View bbrowning's full-sized avatar

Ben Browning bbrowning

  • Red Hat
  • Ashburn, VA
View GitHub Profile
@bbrowning
bbrowning / TorqueBox Lite on Heroku.md
Last active October 14, 2015 01:18
TorqueBox Lite on Heroku

TorqueBox Lite is a web-only, smaller cousin to TorqueBox. It doesn't support scheduled jobs, messaging, services, or any of the other non-web features of TorqueBox. What you do get is the great web performance of TorqueBox in a smaller package. Now that Heroku officially supports JRuby, it's easy to choose TorqueBox Lite as your web server.

Make sure you've created a JRuby application on Heroku and then simply add 'torquebox-lite' to your Gemfile and Procfile as shown below.

08:41:30,006 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Stats for Queue /queues/foo
08:41:30,006 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Paused: false
08:41:30,006 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Temporary: false
08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Message Count: 0
08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Delivering Count: 0
08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Scheduled Count: 0
08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Messages Added Since Creation: 6
08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Consumer Count: 1
08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Expiry Address: jms.queue.ExpiryQueue
08:41:30,007 INFO [stdout] (JobScheduler$blah-knob.yml_Worker-2) Dead Letter Address: jms.queue.DLQ
@bbrowning
bbrowning / standalone.xml.diff
Created November 30, 2012 01:10
TorqueBox 2.1.2 to 2.2.0 standalone.xml changes
@@ -42,6 +42,7 @@
<extension module="org.torquebox.cdi"/>
<extension module="org.projectodd.polyglot.hasingleton"/>
<extension module="org.projectodd.polyglot.cache"/>
+ <extension module="org.projectodd.polyglot.stomp"/>
</extensions>
<system-properties>
@@ -405,7 +406,7 @@
</subsystem>
1.8.7-p357 :001 > $:.unshift('a')
=> ["a", "/Users/bbrowning/src/jruby/lib/ruby/site_ruby/1.8", "/Users/bbrowning/src/jruby/lib/ruby/shared", "/Users/bbrowning/src/jruby/lib/ruby/1.8", "."]
1.8.7-p357 :002 > require 'test'
2012-07-27T15:19:48.228-04:00: LoadService: LoadService: trying builtinLib: test.rb
2012-07-27T15:19:48.228-04:00: LoadService: LoadService: trying builtinLib: test.class
2012-07-27T15:19:48.229-04:00: LoadService: LoadService: trying resourceFromLoadPath: '/Users/bbrowning/tmp/loadpaths/a/test.rb' true true
2012-07-27T15:19:48.229-04:00: LoadService: LoadService: found: file:/Users/bbrowning/tmp/loadpaths/a/test.rb
LOADING FROM a
=> true
1.8.7-p357 :003 > $:.unshift('b')
@bbrowning
bbrowning / README.md
Created July 27, 2012 17:48
Diffs of the minimum changes required to convert a TB 2.0.3 config to work with TB 2.1.0

Below are the minimum changes required to get the underlying AS7 config file in TorqueBox 2.0.3 to work with TorqueBox 2.1.0. There's one diff for non-clustered environments (standalone.xml) and another for clustered environments (standalone-ha.xml).

If you are clustering without multicast, then you'll also need to add the attribute advertise='false' to the `` element in standalone-ha.xml in addition to the changes below.

commit accb5763547fc74b60c0942354f97a72a6eb9bd3
Author: Ben Browning <bbrownin@redhat.com>
Date: Mon May 14 10:17:10 2012 -0400
Ruby's recursiveKey is read-only, doesn't need to be ThreadLocal (Fixes #162)
Modified src/org/jruby/Ruby.java
diff --git a/src/org/jruby/Ruby.java b/src/org/jruby/Ruby.java
index feb66ce..5912532 100644
--- a/src/org/jruby/Ruby.java
package org.jruby.test;
import junit.framework.TestCase;
import org.jruby.CompatVersion;
import org.jruby.Ruby;
import org.jruby.RubyInstanceConfig;
public class TestRecursiveCheck extends TestCase {
private Ruby runtime;
# saved as config/initializers/driver_manager.rb
class Java::java.sql::DriverManager
class << self
alias_method :get_connection_without_oracle, :getConnection
def getConnection(*args)
get_connection_without_oracle(*args)
rescue => e
if args.length == 2 && args[0] =~ /oracle/
Java::oracle.jdbc.OracleDriver.new.connect(*args)
else
@bbrowning
bbrowning / jruby167
Created April 19, 2012 18:30
Simple Rails App Java 6 & JRuby 1.6.7 vs Java 7 and JRuby 1.7
bbrowning@bbrowning-mbp:~/tmp/rails3.1_basic$ jruby -v
jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [darwin-x86_64-java]
bbrowning@bbrowning-mbp:~/tmp/rails3.1_basic$ PRESERVE_JAVA_OPTS=true torquebox run
bbrowning@bbrowning-mbp:~$ ab -c 7 -n 1000 -k http://localhost:8080/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 100 requests
@bbrowning
bbrowning / gist:2418603
Created April 19, 2012 04:39
TorqueBox 2.x Incremental Build 955 and JRuby 1.7
bbrowning@bbrowning-mbp:~/tmp/blah$ ls
config.ru
bbrowning@bbrowning-mbp:~/tmp/blah$ cat config.ru
app = lambda { |env|
[200, { 'Content-Type' => 'text/html' }, "Hello from JRuby 1.7\n" ]
}
run app
bbrowning@bbrowning-mbp:~/tmp/blah$ rvm install jruby-head
Already installed jruby-head.
To reinstall use: