Closed bigdaddymax closed 5 years ago
Thanks for your pull request. I am going to create a new branch "add-pub-sub" to allow testing and refinement of your code. I should have the new branch created in a few days, and will send you instructions on how to move your pull requests to that branch. Thanks for your patience!
I've added a feature branch named "add-pub-sub" to the imagezmq repository. Could you please move your pull request to that branch? Instructions here.. I believe adding PUB/SUB is a useful feature and I appreciate your contribution. Let's develop your contribution in the "add-pub-sub" branch until it is refined and tested. After development and testing, I will merge it to the master branch. Thanks!
I have changed the base to "add-pub-sub" branch.
I am working on a set of test scripts for PUB/SUB pattern, hope to get it done within a few days.
Thank you!
Thanks! I was going to suggest tests scripts as the next step, before we got further with the actual code changes. Please put the test scripts in the "tests" folder in a single file named test_pub_sub.py. My preferred working style for this library is 1) open feature branch 2) build test scripts, 3) build docs, 4) develop code 5) test code against test scripts and then iterate. Thanks again for being a contributor to the library; I will add you to a contributors list in the main README.rst. I am going to add the "preferred working style" list as well. I should have done that already.
This is a great suggestion, let me try to apply those changes.
This is one of my very first experiments with Python so be ready that my next fix will be pretty far from ideal as well. But I would like to come to an acceptable solution at the end with your help.
I really appreciate all your comments and suggestions.
Hi Jeff, I have added simple examples (tests/test_1_pub.py and tests/test_1_sub.py), also modified a little bit tests/test_1_send_images.py and tests/test_1_receive_images.py scripts to demonstrate the difference between the two modes.
Also, modified the module itself according to your suggestions.
Could you please review and comment on what else should be changed?
Next step will be to add a little bit more complex tests/examples.
Thanks.
This looks good. It looks like you have done a good job of incorporating all my requested changes. And you have improved and cleaned up some of the other code. Thanks! I will review this for a couple of days and merge it to our add-pub-sub branch. I will make some further changes that you can pull and change / review. We can iterate from there. Thanks again for your contribution. This is good work. Jeff
The first part: code only.
All changes are nonbreaking, should not change existing codes behavior.
Changes to
ImageSender
block
. Defaults to True, the sender will be created with REQ socket (current functionality). Ifblock
is set to False the sender will be created with PUB socket.Changes to
ImageHub
block
. Defaults to True, the hub will create REP socket (current functionality). Ifblock
is set to False the hub will connect to SUB socket and will subscribe for messages.connect
- in PUB/SUB mode one subscriber can receive messages (images) from many different senders, this method allows to connect and subscribe when needed.Confusing point
When creating ImageSender and ImageHub with
block = False
pay attention to socket settings. Probably, there is a better and cleaner solution, however, this implementation allows to avoid breaking existing projects.