Is 0MQ a protocol, a layer, or both? Can I use it in conjunction with STOMP?
I've tied myself in knots, being new to both STOMP and 0MQ, but in a nutshell, I want to facilitate client to client communication in the browser with interaction from a PHP MOM or a number of PHP MOMs. I'm considering using WebSocket to provide persistent duplex connections (when available) between html5 browser clients and the MOM endpoints, and then use those endpoints to facilitate communication between any number of browser clients, which may be related by 1-1, 1-many, many-1 relationships.
The MOM endpoints may communicate with other servers, or amongst themselves, for different purposes, and I believe that 0MQ may be a viable way to exchange information quickly between these servers. As a protocol for messaging between clients, STOMP looks good (though I'm aware of some problems with the protocols definition)....
.... so here's my point of confusion. To use STOMP, the MOM would have to be a STOMP broker, and if its a STOMP broker, then as 0MQ is a 'brokerless' messaging layer, wouldn't I be defeating the purpose of using both?
To clarify, I'm considering 0MQ for MOM - MOM communication, and STOMP for client - client communication.
Unless of course, there is a way in which I could repurpose 0MQ to facilitate client to client communications? I guess my real confusion is with 0MQ- is it a light weight messaging layer, and not a protocol, or both? If its a layer only, couldn't I use 0MQ to transport STOMP messages?
If anyone could shine some light on 0MQ for me, I'd be very grateful- thanks!
0MQ provides a server-less socket-like API, over which you can overlay your own protocols. 0MQ transports plain uninterpreted binary data (though some of the language bindings add support for specific serialisations like python pickling or JSON).
Unlike normal sockets, 0MQ sockets can be many-to-one, one-to-many.
0MQ also has the notion of messaging patterns - for example, you can define REQ/REP sockets, which enforce the constraint that each request must be followed by a response - you are not permitted to send two requests in a row. There are various other patterns to suit different situations.
So to answer some of your question - 0MQ is basically a messaging layer, and in principle you should be able to send STOMP over 0MQ sockets just as for normal network sockets. However, I'm not sure that a web client can use 0MQ directly - it needs language bindings and the ZMQ native libraries need to be available. I think this rules it out for web client usage.