Questions tagged [pyzmq]

PyZMQ is the Python bindings for 0MQ (also spelled ZeroMQ, ØMQ or ZMQ), written almost entirely in Cython

Python bindings for 0MQ, a high-performance asynchronous messaging library aimed at use in scalable distributed or concurrent applications. It provides a message queue, but unlike message-oriented middleware, a 0MQ system runs without a dedicated message broker.

For a brief introduction read the ZeroMQ concept & properties from

PyZMQ works with Python 3 (≥ 3.3), and Python 2.7, with no transformations or 2to3, as well as PyPy (at least 2.0 beta), via CFFI.

PyZMQ started it python journey since the ZeroMQ API v2.1.1, those days in Python 2.6

Useful links:

627 questions
10
votes
1 answer

How to add topic filters when calling recv_pyobj() in ZeroMQ?

ZeroMQ provides pretty good documentation about how to set up a pub-sub pattern with the topic filter, as described in the api docs. ZeroMQ also provides the methods socket.send_json() and socket.send_pyobj() (and the recv counterparts) for…
Wapiti
  • 1,851
  • 2
  • 20
  • 40
10
votes
1 answer

Sharing data using pyzmq zero-copy

I stumbled on zeromq when searching for an efficient solution to IPC in python; I have a couple of python processes which need to do some cpu intensive processing on data from a dict in a master process. These worker processes only read from the…
Martijnh
  • 333
  • 2
  • 10
9
votes
2 answers

How to expose a container port outside of docker/container using docker-compose?

I have a container that it has several ports, I want to have access to one of its ports (9001) outside of this docker as remote. My docker IP is: 172.17.0.1 My container IP is: 172.19.0.23 My server IP is: 192.168.1.131 I have searched about that…
Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
9
votes
1 answer

Understanding ZMQ's HWM

I'm having some trouble understanding how the ZeroMQ high-water mark (HWM) queues work. I have made two scripts attached below, which reproduce the following. Stablish a PUSH/PULL connection, Setting all HWM queues to size 1. Make the puller sleep…
Guimo
  • 632
  • 1
  • 7
  • 15
9
votes
1 answer

ZeroMQ: Same context for multiple sockets

I am trying to use ZeroMQ's pub-sub sockets. However, I don't clearly understand the role of context (zmq::context_t) while creating sockets (zmq::socket_t). Assuming that I want to create 5 subscriber sockets (zmq::socket_t using ZMQ_SUB), do I…
JhnElaine
  • 93
  • 1
  • 4
9
votes
3 answers

ZeroMQ REQ/REP server error handling

I am trying to use the ZeroMQ rep/req and cannot figure out how to handle server side errors. Look at the code from here: socket.bind("tcp://*:%s" % port) while True: # Wait for next request from client message = socket.recv() print…
Tom Bennett
  • 2,305
  • 5
  • 24
  • 32
8
votes
2 answers

How to have limited ZMQ (ZeroMQ - PyZMQ) queue buffer size in python?

I'm using pyzmq library with pub/sub pattern. I have some fast ZMQ publishers using .connect() method and a slower ZMQ subscriber using .bind() method. Then after a few minutes, my subscriber receives the old data published from the publisher — due…
Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
8
votes
2 answers

Jupyter notebook python crash on Windows 10

I have spent a week searching and trying different solutions with no luck. I've seen several others having the same problems going back over a year. The issue: Windows 10 Pro build 15063.674 I'm using the latest Anaconda 5 build with Python 3.6.2…
user3220892
  • 227
  • 5
  • 10
8
votes
1 answer

Interrupting Flask app in iPythonNotebook cause ZMQerror

I'm trying to run a most simple demo of flask app in an iPython notebook like this. from flask import Flask app = Flask(__name__) @app.route('/') def hello_world():. return 'Hello World!' if __name__ == '__main__': app.run(d) The first…
zaxliu
  • 2,726
  • 1
  • 22
  • 26
8
votes
4 answers

Stop pyzmq receiver by KeyboardInterrupt

Following this example in the ØMQ docs, I'm trying to create a simple receiver. The example uses infinite loop. Everything works just fine. However, on MS Windows, when I hit CTRL+C to raise KeyboardInterrupt, the loop does not break. It seems that…
Tregoreg
  • 18,872
  • 15
  • 48
  • 69
7
votes
1 answer

How to I transfer an image(opencv Matrix/numpy array) from c++ publisher to python sender via ZeroMQ?

I know how to send a string message from c++ to python via zeromq. Here's the code for sending a string message I know : C++ sender code : void *context = zmq_ctx_new(); void *publisher = zmq_socket(context, ZMQ_PUB); int bind = zmq_bind(publisher,…
Rohit Lal
  • 2,791
  • 1
  • 20
  • 36
7
votes
3 answers

How to install pyzmq on an Alpine Linux container?

I have a container with the python:3.6-alpine kernel. I have a problem installing the pyzmq via pip on this: Dockerfile: FROM python:3.6-alpine RUN mkdir /code RUN apk add vim WORKDIR / ADD . /code docker-compose.yml: version: '3' services: …
Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
7
votes
2 answers

What is the difference between using ZMQ PUB with .connect() or .bind() methods?

In Python ZMQ publisher/subscriber sample template, the publisher uses .bind() method and the subscriber uses .connect() method, that connected to the bind IP address. But we can replace .bind() and .connect() each with the other. My question is…
Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
7
votes
1 answer

Python threading queue is very slow

I acquire samples (integers) at a very high rate (several kilo samples per seconds) in a thread and put() them in a threading.Queue. The main thread get()s the samples one by one into a list of length 4096, then msgpacks them and finally sends them…
xaratustra
  • 647
  • 1
  • 14
  • 28
7
votes
1 answer

pyzmq recv_json can't decode message sent by send_json

Here is my code with the extraneous stuff stripped out: coordinator.py context = zmq.Context() socket = context.socket(zmq.ROUTER) port = socket.bind_to_random_port(ZMQ_ADDRESS) poller = zmq.Poller() poller.register(socket, zmq.POLLIN) while…
Anentropic
  • 32,188
  • 12
  • 99
  • 147
1
2
3
41 42