def _receive_response_v_1_0(self, socket): message_type = int(socket.recv()) assert message_type in zmq_names.RESPONSE_TYPES, "Response expected!" message_id = socket.recv_string() assert message_id != '', "Valid message id expected!" if message_type == zmq_names.REPLY_TYPE: reply_body, failure = socket.recv_loaded() reply = zmq_response.Reply(message_id=message_id, reply_body=reply_body, failure=failure) return reply else: ack = zmq_response.Ack(message_id=message_id) return ack
def _acknowledge(self, reply_id, message_id, socket): ack = zmq_response.Ack(message_id=message_id, reply_id=reply_id) self.ack_sender.send(socket, ack)
def acknowledge(self): if self.ack_sender is not None: ack = zmq_response.Ack(message_id=self.message_id, reply_id=self.reply_id) self.ack_sender.send(self.socket, ack)