コード例 #1
0
ファイル: deepsix.py プロジェクト: mirzawaqasahmed/congress
    def subscribe(self,
                  key,
                  dataindex,
                  corrId="",
                  callback=None,
                  pull=False,
                  interval=30,
                  args={}):
        """Subscribe to a DATAINDEX for a given KEY."""
        self.log_info("subscribed to %s with dataindex %s", key, dataindex)

        msg = d6message.d6msg(key=key,
                              replyTo=self.name,
                              correlationId=corrId,
                              dataindex=dataindex,
                              body=args)
        if pull:
            msg.type = 'pull'
        else:
            msg.type = 'sub'

        corruuid = msg.correlationId

        self.subdata[corruuid] = dataobj.subData(key, dataindex, corruuid,
                                                 callback)
        self.scheduuids.add(corruuid)
        self.schedule(msg, corruuid, interval)

        return corruuid
コード例 #2
0
ファイル: deepsix.py プロジェクト: mirzawaqasahmed/congress
    def request(self,
                key,
                dataindex,
                corrId="",
                callback=None,
                interval=0,
                timer=30,
                args={}):
        msg = d6message.d6msg(key=key,
                              replyTo=self.name,
                              correlationId=corrId,
                              type="req",
                              dataindex=dataindex,
                              body=args)

        corruuid = msg.correlationId
        self.subdata[corruuid] = dataobj.subData(key, dataindex, corruuid,
                                                 callback)

        if interval:
            self.scheduuids.add(corruuid)
            self.schedule(msg, corruuid, interval, callback)
        else:

            self.send(msg)

            if timer:
                self.timerThreads.append(
                    eventlet.spawn_after(timer, self.reqtimeout, corruuid))
コード例 #3
0
ファイル: deepsix.py プロジェクト: swsiyu/congress
    def command(
            self,
            key,
            command,
            corrId="",
            callback=None,
            timer=30,
            args={}):
        msg = d6message.d6msg(key=key,
                              replyTo=self.name,
                              type="cmd",
                              correlationId=corrId,
                              dataindex=command,
                              body=args)

        corruuid = msg.correlationId

        self.subdata[corruuid] = dataobj.subData(key, command,
                                                 corruuid, callback)

        self.send(msg)

        if timer:
            self.timerThreads.append(
                eventlet.spawn_after(timer,
                                     self.reqtimeout,
                                     corruuid))
コード例 #4
0
ファイル: deepsix.py プロジェクト: swsiyu/congress
    def subscribe(
            self,
            key,
            dataindex,
            corrId="",
            callback=None,
            pull=False,
            interval=30,
            args={}):
        """Subscribe to a DATAINDEX for a given KEY."""
        self.log_debug("subscribed to %s with dataindex %s", key, dataindex)

        msg = d6message.d6msg(key=key,
                              replyTo=self.name,
                              correlationId=corrId,
                              dataindex=dataindex,
                              body=args)
        if pull:
            msg.type = 'pull'
        else:
            msg.type = 'sub'

        corruuid = msg.correlationId

        self.subdata[corruuid] = dataobj.subData(key, dataindex,
                                                 corruuid, callback)
        self.scheduuids.add(corruuid)
        self.schedule(msg, corruuid, interval)

        return corruuid
コード例 #5
0
ファイル: deepsix.py プロジェクト: swsiyu/congress
    def request(
            self,
            key,
            dataindex,
            corrId="",
            callback=None,
            interval=0,
            timer=30,
            args={}):
        msg = d6message.d6msg(key=key,
                              replyTo=self.name,
                              correlationId=corrId,
                              type="req",
                              dataindex=dataindex,
                              body=args)

        corruuid = msg.correlationId
        self.subdata[corruuid] = dataobj.subData(key, dataindex,
                                                 corruuid, callback)

        if interval:
            self.scheduuids.add(corruuid)
            self.schedule(msg, corruuid, interval, callback)
        else:

            self.send(msg)

            if timer:
                self.timerThreads.append(
                    eventlet.spawn_after(timer,
                                         self.reqtimeout,
                                         corruuid))
コード例 #6
0
ファイル: deepsix.py プロジェクト: mirzawaqasahmed/congress
    def command(self,
                key,
                command,
                corrId="",
                callback=None,
                timer=30,
                args={}):
        msg = d6message.d6msg(key=key,
                              replyTo=self.name,
                              type="cmd",
                              correlationId=corrId,
                              dataindex=command,
                              body=args)

        corruuid = msg.correlationId

        self.subdata[corruuid] = dataobj.subData(key, command, corruuid,
                                                 callback)

        self.send(msg)

        if timer:
            self.timerThreads.append(
                eventlet.spawn_after(timer, self.reqtimeout, corruuid))