Connecting ROUTER and 2 POLLERS

Viewed 13

I am trying to build ROUTER that can connects to a POLLERS

import zmq
identity = "router_test"
conn_str = "tcp://localhost:5050"

context = zmq.Context()
socket = context.socket(zmq.ROUTER)
socket.setsockopt(zmq.SNDHWM, 1)
socket.setsockopt(zmq.RCVHWM, 1)
socket.setsockopt(zmq.LINGER, 0)  # on socket shutdown, discard unsent messages

socket.bind(conn_str)

pollin = zmq.Poller()
pollin.register(socket, zmq.POLLIN)
pollout = zmq.Poller()
pollout.register(socket, zmq.POLLOUT)

Question: I am not sure what the communication pattern below mean when we use POLLER and a ROUTER? Why we also use 2 Pollers instead of 1 (POLLIN, POLLOUT)?

I am not sure if the the communication pattern diagram is as follows:

enter image description here

0 Answers
Related