Esempio n. 1
0
    def callback(self):
        user = self.routing_key[4:]

        if user in UserSession.users:
            self.sendToUserDevices(user, self.body)
            CHAT_LOG.info("e2e user in user session:%s", user)
        else:
            redis_cli = RedisClient()
            redis_cli.addUserOfflineMessage(user, self.body)
            CHAT_LOG.info("e2e user not in user session:%s", user)

        print "e2e call back processor"
Esempio n. 2
0
    def callback(self):
        user = self.routing_key[4:]

        if user in UserSession.users:
            self.sendToUserDevices(user, self.body)
            CHAT_LOG.info("e2e user in user session:%s", user)
        else:
            redis_cli = RedisClient()
            redis_cli.addUserOfflineMessage(user, self.body)
            CHAT_LOG.info("e2e user not in user session:%s", user)

        print "e2e call back processor"
Esempio n. 3
0
    def callback(self):
        json_body = json.loads(self.body)
        if KEY_GROUP_NAME in json_body:
            group_name = json_body[KEY_GROUP_NAME]
        else:
            CHAT_LOG.error('group name not in message body')
            return

        redis_cli = RedisClient()
        users = redis_cli.queryUsersByGroupInServer(group_name, SERVER_SCORE)
        CHAT_LOG.debug("users in current serve:%s",users)

        for user in users:
            if user in UserSession.users:
                self.sendToUserDevices(user, self.body)
                CHAT_LOG.info("group user in user session:%s", user)
            else:
                CHAT_LOG.info("group user not in user session:%s", user)
                redis_cli.addUserOfflineMessage(user, self.body)
Esempio n. 4
0
    def callback(self):
        json_body = json.loads(self.body)
        if KEY_GROUP_NAME in json_body:
            group_name = json_body[KEY_GROUP_NAME]
        else:
            CHAT_LOG.error('group name not in message body')
            return

        redis_cli = RedisClient()
        users = redis_cli.queryUsersByGroupInServer(group_name, SERVER_SCORE)
        CHAT_LOG.debug("users in current serve:%s", users)

        for user in users:
            if user in UserSession.users:
                self.sendToUserDevices(user, self.body)
                CHAT_LOG.info("group user in user session:%s", user)
            else:
                CHAT_LOG.info("group user not in user session:%s", user)
                redis_cli.addUserOfflineMessage(user, self.body)