Пример #1
0
            "push": True,
            "type": "newpost",
            "data": {
                "post": post
            }
        },
        ensure_ascii=False)
    for conn in allconn:
        QueueWork.producer.publish(body=to_push,
                                   delivery_mode=2,
                                   headers={"connid": conn.connection_id},
                                   routing_key=conn.queue_id,
                                   compression='gzip')


if __name__ == '__main__':
    config_model = 'configs.frontend'
    opts, args = getopt.getopt(sys.argv[1:], 'c:', ['config='])
    for k, v in opts:
        if k in ('-c', '--config'):
            config_model = v
    try:
        configs = importlib.import_module(config_model)
    except Exception, e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction = RequestWork
    QueueWork.init(configs.Queue_Server, configs.Queue_Port,
                   configs.Queue_Path, configs.Queue_User,
                   configs.Queue_PassWord, 'sys.post_to_notify')
    QueueWork.run()
    QueueWork.producer.publish(
        body=to_push,
        delivery_mode=2,
        headers={"connid": conn.connection_id},
        routing_key=conn.queue_id,
        compression="gzip",
    )


if __name__ == "__main__":
    config_model = "configs.frontend"
    opts, args = getopt.getopt(sys.argv[1:], "c:", ["config="])
    for k, v in opts:
        if k in ("-c", "--config"):
            config_model = v
    try:
        configs = importlib.import_module(config_model)
    except Exception, e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction = RequestWork
    QueueWork.init(
        configs.Queue_Server,
        configs.Queue_Port,
        configs.Queue_Path,
        configs.Queue_User,
        configs.Queue_PassWord,
        "sys.user_phonebook_update",
    )
    QueueWork.run()
Пример #3
0
            to_uid.remove(reply['uid'])

        conns=session.query(ConnectionInfo).filter(ConnectionInfo.uid.in_(list(to_uid))).all()
        to_push=json.dumps({"push":True,
                                "type":"newreply",
                                "data":{
                                    "gid":post.group_id,
                                    "reply":reply
                                }
                            })
        for conn in conns:
            QueueWork.producer.publish(body=to_push,delivery_mode=2,headers={"connid":conn.connection_id},
                                      routing_key=conn.queue_id,
                                      compression='gzip')
if __name__ == '__main__':
    config_model='configs.frontend'
    opts, args=getopt.getopt(sys.argv[1:],'c:',
                             ['config='])
    for k,v in opts:
        if k in ('-c','--config'):
            config_model=v
    try:
        configs=importlib.import_module(config_model)
    except Exception,e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction=RequestWork
    QueueWork.init(configs.Queue_Server,configs.Queue_Port,configs.Queue_Path,
                    configs.Queue_User,configs.Queue_PassWord,'sys.newreply')
    QueueWork.run()
Пример #4
0
                body=to_push,
                delivery_mode=2,
                headers={"connid": conn.connection_id},
                routing_key=conn.queue_id,
                compression="gzip",
                exchange="front_end",
            )


if __name__ == "__main__":
    config_model = "configs.frontend"
    opts, args = getopt.getopt(sys.argv[1:], "c:", ["config="])
    for k, v in opts:
        if k in ("-c", "--config"):
            config_model = v
    try:
        configs = importlib.import_module(config_model)
    except Exception, e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction = RequestWork
    QueueWork.init(
        configs.Queue_Server,
        configs.Queue_Port,
        configs.Queue_Path,
        configs.Queue_User,
        configs.Queue_PassWord,
        "sys.event",
    )
    QueueWork.run()
                elif post.get('lat',None):
                    allword=u"%s发了一个位置"%(user.nick)
                if allword:
                    if iosdev.is_debug:
                        publish_debug_exchange.publish("body",headers={"message":allword,
                          "uhid":iosdev.device_token})
                    else:
                        publish_release_exchange.publish("body",headers={"message":allword,
                          "uhid":iosdev.device_token})
exchange=None
publish_debug_exchange = None
publish_release_exchange = None
if __name__ == '__main__':
    config_model='configs.frontend'
    opts, args=getopt.getopt(sys.argv[1:],'c:',
                             ['config='])
    for k,v in opts:
        if k in ('-c','--config'):
            config_model=v
    try:
        configs=importlib.import_module(config_model)
    except Exception,e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction=RequestWork
    QueueWork.init(configs.Queue_Server,configs.Queue_Port,configs.Queue_Path,
                    configs.Queue_User,configs.Queue_PassWord,'sys.message_to_notify')
    exchange=Exchange("sys.apn",type='topic',channel=QueueWork.channel,durable=True,delivery_mode=2)
    publish_debug_exchange = Producer(QueueWork.channel,exchange,routing_key='msg.debug')
    publish_release_exchange = Producer(QueueWork.channel,exchange,routing_key='msg.release')
    QueueWork.run()
                          "uhid":iosdev.device_token,"badge":iosdev.badge+1})
                    else:
                        publish_release_exchange.publish("body",headers={"message":push_word,
                          "uhid":iosdev.device_token,"badge":iosdev.badge+1})
                session.query(IOSDevice).filter(IOSDevice.uid.in_(offline_uids)).update({IOSDevice.badge:IOSDevice.badge+1},False)
                session.commit()

exchange=None
publish_debug_exchange = None
publish_release_exchange = None

if __name__ == '__main__':
    config_model='configs.frontend'
    opts, args=getopt.getopt(sys.argv[1:],'c:',
                             ['config='])
    for k,v in opts:
        if k in ('-c','--config'):
            config_model=v
    try:
        configs=importlib.import_module(config_model)
    except Exception,e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction=RequestWork
    QueueWork.init(configs.Queue_Server,configs.Queue_Port,configs.Queue_Path,
                    configs.Queue_User,configs.Queue_PassWord,'sys.circle_new_board')
    exchange=Exchange("sys.apn",type='topic',channel=QueueWork.channel,durable=True,delivery_mode=2)
    publish_debug_exchange = Producer(QueueWork.channel,exchange,routing_key='msg.debug')
    publish_release_exchange = Producer(QueueWork.channel,exchange,routing_key='msg.release')
    QueueWork.run()
Пример #7
0
        send_weixin.publish(DefJsonEncoder.encode({
            'weixin_users':list(to_weixin_user),
            'content':msg_content
        }))

exchange=None
publish_debug_exchange = None
publish_release_exchange = None
send_weixin=None

if __name__ == '__main__':
    config_model='configs.frontend'
    opts, args=getopt.getopt(sys.argv[1:],'c:',
                             ['config='])
    for k,v in opts:
        if k in ('-c','--config'):
            config_model=v
    try:
        configs=importlib.import_module(config_model)
    except Exception,e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction=RequestWork
    QueueWork.init(configs.Queue_Server,configs.Queue_Port,configs.Queue_Path,
                    configs.Queue_User,configs.Queue_PassWord,'sys.paylog',exchange_name="system")
    exchange=Exchange("sys.apn",type='topic',channel=QueueWork.channel,durable=True,delivery_mode=2)
    publish_debug_exchange = Producer(QueueWork.channel,exchange,routing_key='msg.debug')
    publish_release_exchange = Producer(QueueWork.channel,exchange,routing_key='msg.release')
    send_weixin = Producer(QueueWork.channel,routing_key='sys.sendweixin')

    QueueWork.run()
        {
            "push": True,
            "type": "fromphonebook",
            "data": {
                "users": userlist
            }
        },
        cls=AutoFitJson)
    QueueWork.producer.publish(body=to_push,
                               delivery_mode=2,
                               headers={"connid": conn.connection_id},
                               routing_key=conn.queue_id,
                               compression='gzip')


if __name__ == '__main__':
    config_model = 'configs.frontend'
    opts, args = getopt.getopt(sys.argv[1:], 'c:', ['config='])
    for k, v in opts:
        if k in ('-c', '--config'):
            config_model = v
    try:
        configs = importlib.import_module(config_model)
    except Exception, e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction = RequestWork
    QueueWork.init(configs.Queue_Server, configs.Queue_Port,
                   configs.Queue_Path, configs.Queue_User,
                   configs.Queue_PassWord, 'sys.user_phonebook_update')
    QueueWork.run()
Пример #9
0
                if "cdata" in request and isinstance(result, dict):
                    result["cdata"] = request["cdata"]
                if isinstance(result, (dict, list)):
                    return params, json.dumps(result, ensure_ascii=False, cls=AutoFitJson)
                elif isinstance(result, basestring):
                    return params, result
            except BaseException, e:
                return params, traceback.format_exc()
    return params, "error"


if __name__ == "__main__":
    function_list = LoadProcFunctionList()

    config_model = "configs.frontend"
    opts, args = getopt.getopt(sys.argv[1:], "c:", ["config="])
    for k, v in opts:
        if k in ("-c", "--config"):
            config_model = v
    try:
        configs = importlib.import_module(config_model)
    except Exception, e:
        print "config error", str(e)
        exit(0)
    QueueWork.WorkFunction = RequestWork
    QueueWork.init(
        configs.Queue_Server, configs.Queue_Port, configs.Queue_Path, configs.Queue_User, configs.Queue_PassWord, "task"
    )
    BackEndEnvData.queue_producer = QueueWork.producer
    QueueWork.run()
Пример #10
0
                #result['push']=False
                if 'cdata' in request and isinstance(result,dict):
                    result['cdata']=request['cdata']
                if isinstance(result,(dict,list)):
                    return params,DefJsonEncoder.encode(result)
                elif isinstance(result,basestring):
                    return params,result
            except BaseException,e:
                return params,traceback.format_exc()
    return params,"error"

if __name__ == '__main__':
    function_list=LoadProcFunctionList()

    config_model='configs.frontend'
    opts, args=getopt.getopt(sys.argv[1:],'c:',
                             ['config='])
    for k,v in opts:
        if k in ('-c','--config'):
            config_model=v
    try:
        configs=importlib.import_module(config_model)
    except Exception,e:
        print 'config error',str(e)
        exit(0)
    QueueWork.WorkFunction=RequestWork
    QueueWork.back_exchange='front_end'
    QueueWork.init(configs.Queue_Server,configs.Queue_Port,configs.Queue_Path,
                    configs.Queue_User,configs.Queue_PassWord,'task','front_end','task.front')
    BackEndEnvData.queue_producer=QueueWork.producer
    QueueWork.run()
Пример #11
0
            "type": "newreply",
            "data": {
                "gid": post.group_id,
                "reply": reply
            }
        })
        for conn in conns:
            QueueWork.producer.publish(body=to_push,
                                       delivery_mode=2,
                                       headers={"connid": conn.connection_id},
                                       routing_key=conn.queue_id,
                                       compression='gzip')


if __name__ == '__main__':
    config_model = 'configs.frontend'
    opts, args = getopt.getopt(sys.argv[1:], 'c:', ['config='])
    for k, v in opts:
        if k in ('-c', '--config'):
            config_model = v
    try:
        configs = importlib.import_module(config_model)
    except Exception, e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction = RequestWork
    QueueWork.init(configs.Queue_Server, configs.Queue_Port,
                   configs.Queue_Path, configs.Queue_User,
                   configs.Queue_PassWord, 'sys.newreply')
    QueueWork.run()
Пример #12
0
                    result['cdata'] = request['cdata']
                if isinstance(result, (dict, list)):
                    return params, json.dumps(result,
                                              ensure_ascii=False,
                                              cls=AutoFitJson)
                elif isinstance(result, basestring):
                    return params, result
            except BaseException, e:
                return params, traceback.format_exc()
    return params, "error"


if __name__ == '__main__':
    function_list = LoadProcFunctionList()

    config_model = 'configs.frontend'
    opts, args = getopt.getopt(sys.argv[1:], 'c:', ['config='])
    for k, v in opts:
        if k in ('-c', '--config'):
            config_model = v
    try:
        configs = importlib.import_module(config_model)
    except Exception, e:
        print 'config error', str(e)
        exit(0)
    QueueWork.WorkFunction = RequestWork
    QueueWork.init(configs.Queue_Server, configs.Queue_Port,
                   configs.Queue_Path, configs.Queue_User,
                   configs.Queue_PassWord, 'task')
    BackEndEnvData.queue_producer = QueueWork.producer
    QueueWork.run()
                          "uhid":iosdev.device_token,"badge":iosdev.badge+1})
                    else:
                        publish_release_exchange.publish("body",headers={"message":push_word,
                          "uhid":iosdev.device_token,"badge":iosdev.badge+1})
                session.query(IOSDevice).filter(IOSDevice.uid.in_(offline_uids)).update({IOSDevice.badge:IOSDevice.badge+1},False)
                session.commit()

exchange=None
publish_debug_exchange = None
publish_release_exchange = None

if __name__ == '__main__':
    config_model='configs.frontend'
    opts, args=getopt.getopt(sys.argv[1:],'c:',
                             ['config='])
    for k,v in opts:
        if k in ('-c','--config'):
            config_model=v
    try:
        configs=importlib.import_module(config_model)
    except Exception,e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction=RequestWork
    QueueWork.init(configs.Queue_Server,configs.Queue_Port,configs.Queue_Path,
                    configs.Queue_User,configs.Queue_PassWord,'group.change')
    exchange=Exchange("sys.apn",type='topic',channel=QueueWork.channel,durable=True,delivery_mode=2)
    publish_debug_exchange = Producer(QueueWork.channel,exchange,routing_key='msg.debug')
    publish_release_exchange = Producer(QueueWork.channel,exchange,routing_key='msg.release')
    QueueWork.run()
Пример #14
0
                      "uhid":iosdev.device_token,"badge":iosdev.badge+1})
                else:
                    publish_release_exchange.publish("body",headers={"message":push_word,
                      "uhid":iosdev.device_token,"badge":iosdev.badge+1})
                session.query(IOSDevice).filter(IOSDevice.uid==touid).update({IOSDevice.badge:IOSDevice.badge+1},False)
                session.commit()

exchange=None
publish_debug_exchange = None
publish_release_exchange = None

if __name__ == '__main__':
    config_model='configs.frontend'
    opts, args=getopt.getopt(sys.argv[1:],'c:',
                             ['config='])
    for k,v in opts:
        if k in ('-c','--config'):
            config_model=v
    try:
        configs=importlib.import_module(config_model)
    except Exception,e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction=RequestWork
    QueueWork.init(configs.Queue_Server,configs.Queue_Port,configs.Queue_Path,
                    configs.Queue_User,configs.Queue_PassWord,'sys.push_to_user')
    exchange=Exchange("sys.apn",type='topic',channel=QueueWork.channel,durable=True,delivery_mode=2)
    publish_debug_exchange = Producer(QueueWork.channel,exchange,routing_key='msg.debug')
    publish_release_exchange = Producer(QueueWork.channel,exchange,routing_key='msg.release')
    QueueWork.run()
Пример #15
0
            "text":
            {
                 "content":post['content']
            }
        }
    else:
        return
    token=weixin.GetAccessToken()
    for u in to_weixin_user:
        msgbody["touser"]=u
        data=weixin.SendMessage(token,msgbody)
exchange=None
publish_debug_exchange = None
publish_release_exchange = None
if __name__ == '__main__':
    config_model='configs.frontend'
    opts, args=getopt.getopt(sys.argv[1:],'c:',
                             ['config='])
    for k,v in opts:
        if k in ('-c','--config'):
            config_model=v
    try:
        configs=importlib.import_module(config_model)
    except Exception,e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction=RequestWork
    QueueWork.init(configs.Queue_Server,configs.Queue_Port,configs.Queue_Path,
                    configs.Queue_User,configs.Queue_PassWord,'sys.sendweixin')
    QueueWork.run()
Пример #16
0
    eo=LoadEvent(event)
    if eo is None:
        return
    with dbconfig.Session() as session:
        conn=session.query(ConnectionInfo).filter(ConnectionInfo.uid==toid).first()

    to_push=json.dumps({"push":True,
                                "type":"event",
                                "data":{
                                    "event":eo
                                }
                            })
    QueueWork.producer.publish(body=to_push,delivery_mode=2,headers={"connid":conn.connection_id},
                                  routing_key=conn.queue_id,
                                  compression='gzip')
if __name__ == '__main__':
    config_model='configs.frontend'
    opts, args=getopt.getopt(sys.argv[1:],'c:',
                             ['config='])
    for k,v in opts:
        if k in ('-c','--config'):
            config_model=v
    try:
        configs=importlib.import_module(config_model)
    except Exception,e:
        print str(e)
        exit(0)
    QueueWork.WorkFunction=RequestWork
    QueueWork.init(configs.Queue_Server,configs.Queue_Port,configs.Queue_Path,
                    configs.Queue_User,configs.Queue_PassWord,'sys.event')
    QueueWork.run()