Closed paneq closed 11 years ago
Maybe it is good enough if we support multiple endpoints only with our own binary ? In most advanced usecases you won't use rails s
or rackup
anyway right ?
I think this is related to #44 . My idea is that you should implemented more complicated use-cases yourself. And load file implementing it with require
:
> rackup --help
Usage: rackup [ruby options] [rack options] [rackup config]
Ruby options:
-r, --require LIBRARY require the library, before executing your script
So I think our user could write a file that implements ConnectionFactory
and sets it to the constant:
#factory.rb
MyCustomConnectionFactory = ConnectionFactory.new.request_parser(parser).context(context).request_socket do |sock|
socket.connect(@request_addr)
socket.setsockopt(ZMQ::IDENTITY, @sender_id)
socket.setsockopt(ZMQ::HWM, 100)
end.response_socket do |sock|
socket.connect(@response_addr)
socket.setsockopt(ZMQ::IDENTITY, @sender_id)
socket.setsockopt(ZMQ::LINGER, 5000)
end
load that file with -r
and set some option to point to Factory that we should used:
rackup -r factory.rb -s mongrel2 rack_app.ru -O factory=MyCustomConnectionFactory
We should handle connecting to multiple mongrel2 endpoints. Either in the same mongrel2 instance or another one (not a real difference for us).
I was wondering about this part of the code:
What are the possible ways of running our rack handler ?
Our binary:
m2r
3rd party binaries:
rackup
rails server
Anything else ?
How are those 3rd party libs processing the commandline options? I was wondering how we can support passing arrays of uuids? Obviously it is easier with our own binary. It could use
thor
I guess: https://github.com/wycats/thor/wiki/Method-Options