So now I reached the point where (almost) all my processes are nicely
configured and they communicate with each other.
But now I would like to design good communication protocols between
them, because otherwise it will be a mess..
I thought about a protocol between each of the communicating couples, as
for example the worker and the sink:
class WorkerSinkProtocol:
"""Communication protocol to communicate between the worker and
the sink, sending results and the actual status.
TODO:Does it make sense to send also the actual status?
"""
def __init__(self, action, message):
self.action = action
self.message = message
def __eq__(self, other):
return (self.action == other.action) and (self.message == other.message)
def serialise(self):
return DELIMITER.join([self.action, self.message])
@classmethod
def unserialise(self, st):
act, msg = st.split(DELIMITER)
return WorkerSinkProtocol(act, msg)
But I'm not sure it makes sense, because I still have to match on
self.action in the code that does the job.
So the alternative might be to have a class for every message type, for
example
class Action(Message):
def __init__(self, task):
...
and then in the protocol create the right action objects, but I'm still
not sure how to proceed.
Any suggestions, ideas on the topic (which looks quite important but I
don't find any useful info around)?
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev