Routing in Reel

105 views
Skip to first unread message

Doug Mayer

unread,
Nov 6, 2012, 12:02:55 AM11/6/12
to cellulo...@googlegroups.com
Has anyone tried hooking up routing within a Reel app? I wouldn't expect anything terribly complex, perhaps just enough to support basic API-style operations? http_router (https://github.com/joshbuddy/http_router) seems like it might be usable in a Reel context.

Thanks!

--
Doug

Tony Arcieri

unread,
Nov 6, 2012, 2:25:21 AM11/6/12
to cellulo...@googlegroups.com
The webmachine-ruby project has a Reel adapter, a router, and is also a pretty nifty HTTP framework in general:

--
Tony Arcieri

Grant Rodgers

unread,
Nov 6, 2012, 12:47:46 PM11/6/12
to cellulo...@googlegroups.com
Recent versions of reel include simple octarine integration:

require 'reel/app'

class FooApp
  include Reel::App
 
  get "/foo" do |request|
    [200, {}, "hello foo"]
  end

end

FooApp.new("0.0.0.0", 3010)

Doug Mayer

unread,
Nov 6, 2012, 7:07:48 PM11/6/12
to cellulo...@googlegroups.com
Webmachine does indeed look pretty slick. I'm having trouble getting its adapter-based system to hook into our existing supervision tree, though. Are you aware of any design that may lend itself well to being started with a top-level supervision group?

I tried creating a wrapper around a Webmachine::Application instance but things seemed to run amok with traps being ignored, etc. Perhaps I just have a little something wrong, which I can dig into further, but I don't want to lose more time on it if it's a clear loser to those more comfortable with such a setup.

Thanks,
Doug

Tony Arcieri

unread,
Nov 6, 2012, 7:19:11 PM11/6/12
to cellulo...@googlegroups.com
I'm working on a project which will be using Webmachine soon. I expect I'll start running into the same problems ;)

There aren't many people using Webmachine + Reel yet (if you are, want to speak up? ;) so unfortunately it's a bit rough around the edges.
--
Tony Arcieri

Doug Mayer

unread,
Nov 7, 2012, 9:45:59 AM11/7/12
to cellulo...@googlegroups.com
I'd love to hear any solution you may come to when you're able to dig into it.

For now, I was able to remove the trap/sleep from Webmachine::Adapters::Reel#run and add an adapter_option for supervise_as to get it running. (Since I already used supervision groups, I had my own sleep it can hit.) I hooked the adapter's embedded Reel::Server shutdown into my existing supervision group's finalize, and it seems to cleanly terminate. It may be that to do this in a supervisor-aware way, we should make a separate entry point into Webmachine, letting the adapter know if it should handle supervision or not?

We'll see if this ends up causing more problems than it solves. :)
Reply all
Reply to author
Forward
0 new messages