facebook / wangle

Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
Apache License 2.0
3.05k stars 539 forks source link

Mq based Pipeline #28

Open BLaurent opened 8 years ago

BLaurent commented 8 years ago

Hi, Quick questions is it possible to configure wangle to use something like zero mq instead of socket ?

Regards Ben

fugalh commented 8 years ago

Conceptually it should be possible, yes. But there isn't code written for it yet. I think you'd need to implement the appropriate Handler subclass, i.e. see channel/Handler.h for the interface and channel/EventBaseHandler.h and channel/AsyncSocketHandler.h for examples/inspiration.

crackcomm commented 8 years ago

It may be useful to mention also bootstrap/ClientBootstrap.h for better understanding.

BLaurent commented 8 years ago

Ok, I think I can do it, but I might need more advise.

For the handler I can see why I need to have one.

so for the Handler shall I create something like that :

class ZMQHandler : public wangle::Handler<  std::unique_ptr<folly::IOBuf>, zmq::message_t,
  zmq::message_t, std::unique_ptr<folly::IOBuf>> 

or Include the content of the message instead, replacing zmq::message_t by std::string for example.

zmq include several communication patterns, so I guess that what service is made for. Mean that for Pub/Sub for example, I'll have publish service that will use the operator() for publishing message and the same on subscribe.

Second is topic filter I was thinking of adding a step to the pipeline to prefix message by a given prefix. What do you think ?

Regards Ben

fugalh commented 8 years ago

I think instead stacking on top of socket and dealing with a byte stream, this would be a terminal type (in place of socket) and let zmq do all the socket work.