Example #1
0
def listThreads(myid, apikey, dst):
    cf.sendmsg(ThreadTracker.makecontrolmsg(myid, dst, apikey),
               listThreadsFinished)
Example #2
0
        sys.exit(2)
    elif o == "-D":
        debug = a
    elif o == "-k":
        apikey = a

myip = '127.0.0.1'
try:
    myip = socket.gethostbyname(socket.gethostname())  # has caveats
except Exception as e:
    print "Trouble finding out our local ip based on hostname: ", socket.gethostname(
    )

global cf
global thread_tracker
thread_tracker = ThreadTracker(False)

cf = Foundation({
    'apikey': apikey,
    'myip': myip,
    'cifrouter': cifrouter,
    'controlport': controlport,
    'routerid': "cif-router",
    'myid': myid,
    'thread_tracker': thread_tracker
})

cf.setdebug(debug)

try:
    if debug > 1:
Example #3
0
socket.setsockopt(zmq.IDENTITY, myname)

poller = zmq.Poller()
poller.register(socket, zmq.POLLIN)

print "Create XSUB socket"
xsub = context.socket(zmq.SUB)
xsub.setsockopt(zmq.SUBSCRIBE, '')

print "Connect XSUB<->XPUB"
thread = threading.Thread(target=myrelay, args=(publisherport,))
thread.start()
while not thread.isAlive():
    print "waiting for pubsub relay thread to become alive"
    time.sleep(1)
thread_tracker = ThreadTracker(False)
thread_tracker.add(id=thread.ident, user='******', host='localhost', state='Running', info="PUBSUB Relay")


print "Entering event loop"

try:
    open_for_business = False
    
    while True:
        sockets_with_data_ready = dict(poller.poll(1000))
        #print "[up " + str(int(mystats.getuptime())) + "s]: Wakeup: "

        if miniclient != None:
            if miniclient.pending() == True:
                print "\tMiniclient has replies we need to handle."
Example #4
0
def listThreads(myid, apikey, dst):
    cf.sendmsg(ThreadTracker.makecontrolmsg(myid, dst, apikey), listThreadsFinished)
Example #5
0
context = zmq.Context()
clients = Clients()
mystats = RouterStats()
routerport = 5555
publisherport = 5556
myid = "cif-router"
dbkey = 'a8fd97c3-9f8b-477b-b45b-ba06719a0088'
dbname = 'cif-db'
global apikey
apikey = 'a1fd11c1-1f1b-477b-b45b-ba06719a0088'
miniclient = None
miniclient_id = myid + "-miniclient"
register_wait_map = {}
unregister_wait_map = {}
thread_tracker = ThreadTracker(False)

for o, a in opts:
    if o == "-r":
        routerport = a
    elif o == "-p":
        publisherport = a
    elif o == "-m":
        myid = a
    elif o == "-dk":
        dbkey = a
    elif o == "-dn":
        dbname = a
    elif o == "-a":
        apikey = a
    elif o == "-h":