예제 #1
0
"""
X7 mq server function
"""
from x7_mq import MqServer

w2sDict = { 'X7_Q':'X7_Q_W2S', 'X7_E':'X7_E_W2S', 'X7_RK':'X7_PK_W2S' }

#: This is the callback applied when a message is received.
def handle_message( pkg, message):
    print("Received message: %r" % (pkg, ))
    message.ack()

if __name__ == '__main__':
    mq_server = MqServer( handle_message, w2sDict )
    mq_server.create_queue();



예제 #2
0
파일: demo_server.py 프로젝트: k3coby/xeven
"""
X7 mq server function
"""
from x7_mq import MqServer

w2sDict = { 'X7_Q':'X7_Q_W2S', 'X7_E':'X7_E_W2S', 'X7_RK':'X7_PK_W2S' }

#: This is the callback applied when a message is received.
def handle_message( pkg, message):
    print("Received message: %r" % (pkg, ))
    message.ack()

if __name__ == '__main__':
    mq_server = MqServer( handle_message, w2sDict )
    mq_server.connect()
    mq_server.run(once=False)



예제 #3
0
파일: mq_receiver.py 프로젝트: k3coby/xeven
import simplejson
import sys, os
import subprocess

def handle_message( pkg, message):
    print("Received message: %r" % (pkg, ))
    message.ack()
    params = simplejson.loads( pkg )

    #begin write file 
    if os.path.isfile('localrc'):
        os.remove('localrc')
    
    eth_interface = params.get("FLAT_INTERFACE","eth0")
    subprocess.Popen(["./inst.sh", eth_interface])
    exit(-1);
    #file = open ( 'localrc', 'w' )
    #for k in params.keys():
    #    file.write( "%s=%s \n"  % (k,params[k]) )

    #file.close()
    
    
if __name__ == '__main__':
    w2sDict = { 'X7_Q':'X7_Q_W2S', 'X7_E':'X7_E_W2S', 'X7_RK':'X7_PK_W2S' }
    
    mq_server = MqServer( handle_message, w2sDict )
    mq_server.connect()
    message = mq_server.run(once=True)