For all on the mailing list, Travis and I spoke on IRC;
The solution here is to have a single handler that talks to both
servers.

Also, to clarify the architecture, the front-end does regular HTTP
requests and the backend server listens on a websocket for request from
their data service.

-Jason

On 22:29 Thu 04 Oct     , Dalton Barreto wrote:
> 2012/10/4 Travis Spencer <[email protected]>:
> > Hi All,
> >
> > I'm wondering if it is possible to tie two Mongrel2 servers together
> > and pass data between their handlers using 0MQ. To do this, I thought
> > that the front-end server should use a handler which sent messages to
> > the port that the back-end server's handler was receiving on.
> > Basically like this:
> >
> > front_end = Server(
> >   ...
> >   hosts = [
> >     Host(name = "...",
> >       routes = {
> >         "/" : Handler(
> >           ...,
> >           send_spec = "tcp://127.0.0.1:9997",
> >           recv_ident = "tcp://127.0.0.1:9996")
> >       }
> >     )
> >   ]
> > )
> > back_end = Server(
> >   ...
> >   hosts = [
> >     Host(name = "...",
> >       routes = {
> >         "/" : Handler(
> >           ...,
> >           send_spec = "tcp://127.0.0.1:9996",
> >           recv_spec = "tcp://127.0.0.1:9997")
> >       }
> >     )
> >   ]
> > )
> >
> > This would result in a flow like this, I had hoped:
> >
> > <-> [Front-end Mongrel2 server] <-> 0MQ <-> [Back-end Mongrel2 server] <->
> >
> > However, when I start the second server, it can't bind to its
> > send_spec because the first server already grabbed it as it's
> > recv_spec.
> >
> > So, my question are these:
> >
> > 1. Is there a better way to do this, in general?
> 
> Hello Travis,
> 
> I'm afraid this is not possible to be done the way you are trying to
> do. The handler specs are specifically
> for the communication between m2 and backend handlers.
> 
> > 2. If this is the way to do it, what details am I missing to be able
> > to send data between these two servers?
> >
> 
> I think the only way to do this is to make the first m2 proxy the
> request to the second. Just add a route that is a proxy and ensure
> that it points to the IP:Port of the second m2 server.
> 
> Hope it helps.
> 
> 
> -- 
> Dalton Barreto
> http://daltonmatos.com
> 

Reply via email to