예제 #1
0
def send_message():
    outsock = DieselZMQSocket(zctx.socket(zmq.DEALER),
                              connect="tcp://127.0.0.1:5000")

    for x in xrange(500000):
        outsock.send("yo dawg %s" % x)
        if x % 1000 == 0:
            sleep()
예제 #2
0
def handle_messages():
    insock = DieselZMQSocket(zctx.socket(zmq.DEALER), bind="inproc://foo")

    for x in xrange(500000):
        msg = insock.recv()
        assert msg == "yo dawg %s" % x
    delt = time.time() - t
    print "500000 messages in %ss (%.1f/s)" % (delt, 500000.0 / delt)
    quickstop()
예제 #3
0
def send_message():
    global t
    outsock = DieselZMQSocket(zctx.socket(zmq.DEALER), connect="inproc://foo")
    t = time.time()

    for x in xrange(500000):
        outsock.send("yo dawg %s" % x)
        if x % 1000 == 0:
            sleep()
예제 #4
0
def echo_client():
    sock = zctx.socket(zmq.DEALER)
    sock.identity = "client:%d" % cids.pop()
    s = DieselZMQSocket(sock, connect='tcp://127.0.0.1:4321')
    for i in xrange(10):
        s.send('msg:%d' % i)
        r = s.recv()
        assert r == 'msg:%d' % i
        print sock.identity, 'received', r
예제 #5
0
def get_messages():
    outsock = DieselZMQSocket(zctx.socket(zmq.DEALER),
                              bind="tcp://127.0.0.1:5000")

    for x in xrange(1000):
        t, m = first(sleep=1.0, waits=[outsock])

        if t == 'sleep':
            print "sleep timeout!"
        else:
            print "zmq:", m

    quickstop()
예제 #6
0
def get_messages():
    outsock = DieselZMQSocket(zctx.socket(zmq.DEALER),
                              bind="tcp://127.0.0.1:5000")

    t = time.time()
    for x in xrange(500000):
        msg = outsock.recv()
        assert msg == "yo dawg %s" % x
        if x % 1000 == 0:
            sleep()

    delt = time.time() - t
    print "500000 messages in %ss (%.1f/s)" % (delt, 500000.0 / delt)
    quickstop()