[zeromq-dev] Reply-Request Pattern: Accessing a specific server method with a client request message?
Jess Updegrove
jessupde at gmail.com
Mon Apr 28 18:15:55 CEST 2014
Hello Community!
I'm a new programmer and I'm trying to build a server that has a bunch of
different functions. I want the architecture to be server-client, in which
a client can connect to the server, send it a list of parameters and the
function it wants the result from, and get a reply. However, I just cannot
seem to figure out how to do this in ZMQ and I'm looking for guidance. I'm
using Python (2.7) and the pyzmq library with the latest version of ZMQ.
I've read the Guide multiple times and looked through a bunch of examples.
Essentially, I want the convo between the client and server to go something
like this:
C: Server, give me the current temperature in Seattle, Washington using the
function get_weather()
S: Accessing get_weather() with argument "Seattle" [goes to it's function
and gets the result]
S: Here's the result!
C: Server, change the temperature (in a database) for Seattle from 50 to 70.
S: Accessing change_value() with key temperature.Seattle.
S: Value updated!
However, I can only find examples that allow me to send a message but not
specify a list of arguments. I also just can't seem to figure out the best
way to send a message from the client and have the server pick it apart and
figure out which function to call without using a ton of if statements
checking the message content. Is ZMQ suitable for what I'm doing? Am I
approaching it incorrectly? Also note that I already built a similar
architecture like this is WAMPV2 using RPC calls and that's essentially
what I'm trying to replicate. I'm new with the terminology used by ZMQ
(sockets, threads, etc.) so it's very likely I'm just confused about how it
all works. Any help would be appreciated!
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140428/f52c825b/attachment.htm>
More information about the zeromq-dev
mailing list