Is it possible to use ZMQ part of Anaconda for custom messaging between jupyter notebooks somehow? My intention is that if there is a boundled solution why should I write my own comm solution, or install something new:-) I would like to query all available notebooks and if the required one is up and running then I want to send custom, streamed data to that notebok. (Previously I made it with asyncio socket server/client architecture with pure.py scripts).
Unfortunately the messaging documentation does not help me too much.
Thank you in advance!
sm.
Q : "Is it possible to use ZMQ part of Anaconda for custom messaging between jupyter notebooks somehow?"
Sure.
Option A:
One may extend the jupyter framework to include all your new functionalities in FOSS core
Option B:
One may instantiate one's own ZeroMQ signaling / messaging infrastructure on top of & independent from the jupyter internal signaling / messaging functionalities, and work just with a pure user-level code.
include zmq
my1stContextINSTANCE = zmq.context() # The Engine
my1stPublisherSOCKET = my1stContextINSTANCE.socket( zmq.PUB ) # its Socket
my1stPublisherSOCKET.setsockopt( zmq.LINGER, 0 ) # configurations
my1stPublisherSOCKET.setsockopt( zmq.SNDBUF, 2000000 ) # ...
...
my1stPullDataSOCKET = my1stContextINSTANCE.socket( zmq.PULL )# its Socket
my1stPullDataSOCKET.setsockopt( zmq.LINGER, 0 ) # configurations
my1stPullDataSOCKET.setsockopt( zmq.RCVBUF, 100000 ) # ...
...
while True:
...
my1stPublisherSOCKET.send( "INF: message payload[{0:}]".format( repr( _ ) ) )
...
if ( my1stPullDataSOCKET.poll( 0 ) ) ... ):
...
elseif:
...
else:
...
continue
Reciprocally the same on all the other peer-sides.
The ZeroMQ framework is smart for doing this, either way. You may like to read this & this .
The architecture design & the implementation wisdom & robustness is yours.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.