예제 #1
0
    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)
예제 #2
0
    def publish(self, dataindex, newdata):
        if dataindex not in self.pubdata:
            self.pubdata[dataindex] = pubData(dataindex)

        self.pubdata[dataindex].update(newdata)

        self.push(dataindex)
예제 #3
0
    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)
예제 #4
0
    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')
예제 #5
0
    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')
예제 #6
0
    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)
예제 #7
0
    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)
예제 #8
0
    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')
예제 #9
0
    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)