I am thinking of using mongrel2 for handling Web request for a service. For the backend, I want to use a Task farm pattern, using the C bindings to zeromq.
After reading the mongrel2 manual though, it is not clear how i can implement this, since the backend handler PULLS messages from mongrel2 and sends messages to mongrel2 using a ZMQ_PUB socket.
I want to forward messages from the handler, to a task farm in the back end, and receive the response back in the handler which then publishes it to mongrel2. Is it possible for a zeromq client to bind to several (2) inputs and several(2) outputs?
FWIW, I am implementing this in ANSI C.
I feel what you are looking for is close to the ventilator pattern outlines in the zeromq guide : http://zguide.zeromq.org/page:all#Divide-and-Conquer .
Both the ventilator and the sink in the diagram would be inside your webservice (you can create multiple sockets in your application).
The PUSH and PULL sockets can push/pull data to any number of downstream/upstream sockets, so your webservice will only need two sockets for any number of workers.