def inreq(self, msg): corruuid = msg.correlationId dataindex = msg.header['dataindex'] if dataindex == "pubdata": newmsg = d6msg(key=msg.replyTo, replyTo=self.name, correlationId=msg.correlationId, type="rep", dataindex=dataindex, body=dataObject(self.pubdata)) self.send(newmsg) elif dataindex == "subdata": newmsg = d6msg(key=msg.replyTo, replyTo=self.name, correlationId=msg.correlationId, type="rep", dataindex=dataindex, body=dataObject(self.subdata)) self.send(newmsg) elif dataindex in self.pubdata: reply = d6msg(replyTo=self.name, type="rep", body=self.pubdata[dataindex].get(), srcmsg=msg) self.send(reply) elif hasattr(self, 'reqhandler'): self.pubdata[dataindex] = pubData(dataindex, msg.body) self.pubdata[dataindex].requesters[msg.replyTo] = corruuid self.reqhandler(msg)
def publish(self, dataindex, newdata): if dataindex not in self.pubdata: self.pubdata[dataindex] = pubData(dataindex) self.pubdata[dataindex].update(newdata) self.push(dataindex)
def incmd(self, msg): corruuid = msg.correlationId dataindex = msg.header['dataindex'] if corruuid not in self.pubdata: self.pubdata[corruuid] = pubData(dataindex, msg.body) self.pubdata[corruuid].requesters[msg.replyTo] = corruuid self.cmdhandler(msg)
def publish(self, dataindex, newdata, key=''): self.log_debug("publishing to dataindex %s with data %s", dataindex, newdata) if dataindex not in self.pubdata: self.pubdata[dataindex] = pubData(dataindex) self.pubdata[dataindex].update(newdata) self.push(dataindex, type='pub')
def publish(self, dataindex, newdata, key=''): self.log("publishing to dataindex {} with data {}".format( str(dataindex), str(newdata))) if dataindex not in self.pubdata: self.pubdata[dataindex] = pubData(dataindex) self.pubdata[dataindex].update(newdata) self.push(dataindex, type='pub')
def incmd(self, msg): self.log("received CMD msg: {}".format(str(msg))) corruuid = msg.correlationId dataindex = msg.header['dataindex'] if corruuid not in self.pubdata: self.pubdata[corruuid] = pubData(dataindex, msg.body) self.pubdata[corruuid].requesters[msg.replyTo] = corruuid self.cmdhandler(msg)
def insub(self, msg): corruuid = msg.correlationId dataindex = msg.header['dataindex'] sender = msg.replyTo if corruuid not in self.subscriberCorrelationUuids: if dataindex not in self.pubdata: self.pubdata[dataindex] = pubData(dataindex, msg.body) if hasattr(self, "subhandler"): self.subhandler(msg) self.pubdata[dataindex].addsubscriber(sender, "push", corruuid) self.subscriberCorrelationUuids.add(corruuid) self.push(dataindex, sender)
def insub(self, msg): self.log("received SUB msg: {}".format(str(msg))) corruuid = msg.correlationId dataindex = msg.header['dataindex'] sender = msg.replyTo if corruuid not in self.subscriberCorrelationUuids: if dataindex not in self.pubdata: self.pubdata[dataindex] = pubData(dataindex, msg.body) if hasattr(self, "subhandler"): self.subhandler(msg) self.pubdata[dataindex].addsubscriber(sender, "push", corruuid) self.subscriberCorrelationUuids.add(corruuid) self.push(dataindex, sender, type='sub')
def inpull(self, msg): dataindex = msg.header['dataindex'] if dataindex in self.pubdata: reply = d6msg(replyTo=self.name, type="rep", body=self.pubdata[dataindex].get(), srcmsg=msg) self.send(reply) else: self.pubdata[dataindex] = pubData(dataindex, msg.body) self.subhandler(msg) self.pubdata[dataindex].addsubscriber( msg.replyTo, "pull", msg.correlationId)