Esempio n. 1
0
def t0():
    c = amqp_shrapnel.client (('guest', 'guest'), '127.0.0.1', heartbeat=30)
    c.go()
    ch = c.channel()
    ch.confirm_select()
    ch.queue_declare (queue='rpc_queue')
    s = rpc_server (ch, 'rpc_queue', '')
    return c,ch,s
Esempio n. 2
0
def t2():
    global c
    c = amqp_shrapnel.client (('guest', 'guest'), '127.0.0.1')
    c.go() # i.e., connect...
    ch = c.channel()
    ch.basic_publish ('howdy there!', exchange='ething', routing_key='notification')
    print 'published!'
    coro.set_exit()
Esempio n. 3
0
def t0():
    c = amqp_shrapnel.client(('guest', 'guest'), '127.0.0.1', heartbeat=30)
    c.go()
    ch = c.channel()
    ch.confirm_select()
    ch.queue_declare(queue='rpc_queue')
    s = rpc_server(ch, 'rpc_queue', '')
    return c, ch, s
Esempio n. 4
0
def t0():
    c = amqp_shrapnel.client (('guest', 'guest'), '127.0.0.1', heartbeat=30)
    c.go()
    ch = c.channel()
    ch.exchange_declare (exchange='ething')
    ch.queue_declare (queue='qthing', passive=False, durable=False)
    ch.queue_bind (exchange='ething', queue='qthing', routing_key='rpc')
    fifo = ch.basic_consume (queue='qthing')
    while 1:
        print fifo.pop()
Esempio n. 5
0
def t2():
    global c
    c = amqp_shrapnel.client (('guest', 'guest'), '127.0.0.1')
    c.debug = debug
    c.go() # i.e., connect...
    ch = c.channel()
    for i in range (10):
        ch.basic_publish ('howdy %d' % (i,), exchange='ething', routing_key='notification')
        coro.sleep_relative (5)
    coro.set_exit()
Esempio n. 6
0
def t0():
    c = amqp_shrapnel.client (('guest', 'guest'), '127.0.0.1', heartbeat=30)
    c.go()
    ch = c.channel()
    rpc = amqp_shrapnel.rpc.client (ch)
    frame, props, reply = rpc.call ({}, '19', '', 'rpc_queue')
    # shut it down
    rpc.cancel()
    c.close()
    print 'got a reply...', reply
    coro.sleep_relative (5)
    coro.set_exit (1)
Esempio n. 7
0
def t0():
    c = amqp_shrapnel.client(("guest", "guest"), "127.0.0.1", heartbeat=30)
    c.debug = debug
    c.go()
    ch = c.channel()
    ch.exchange_declare(exchange="ething")
    ch.queue_declare(queue="qthing", passive=False, durable=False)
    ch.queue_bind(exchange="ething", queue="qthing", routing_key="notification")
    fifo = ch.basic_consume(queue="qthing")
    while 1:
        LOG("waiting")
        msg = fifo.pop()
        LOG("msg", repr(msg))
Esempio n. 8
0
def t0():
    c = amqp_shrapnel.client(('guest', 'guest'), '127.0.0.1', heartbeat=30)
    c.debug = debug
    c.go()
    ch = c.channel()
    ch.exchange_declare(exchange='ething')
    ch.queue_declare(queue='qthing', passive=False, durable=False)
    ch.queue_bind(exchange='ething',
                  queue='qthing',
                  routing_key='notification')
    fifo = ch.basic_consume(queue='qthing')
    while 1:
        LOG('waiting')
        msg = fifo.pop()
        LOG('msg', repr(msg))
Esempio n. 9
0
def t3():
    global c
    c = amqp_shrapnel.client (('guest', 'guest'), '127.0.0.1')
    print 'connecting...'
    c.go() # i.e., connect...
    print 'channel...'
    ch = c.channel()
    print 'confirm_select...'
    ch.confirm_select()
    print 'entering send loop'
    for i in range (10):
        props = {'content-type':'raw goodness', 'message-id' : 'msg_%d' % (i,)}
        ch.basic_publish ('howdy there!', exchange='ething', routing_key='notification', properties=props)
        print 'sent/confirmed'
        coro.sleep_relative (1)
    coro.set_exit()
Esempio n. 10
0
def t3():
    global c
    c = amqp_shrapnel.client(('guest', 'guest'), '127.0.0.1')
    print 'connecting...'
    c.go()  # i.e., connect...
    print 'channel...'
    ch = c.channel()
    print 'confirm_select...'
    ch.confirm_select()
    print 'entering send loop'
    for i in range(10):
        props = {
            'content-type': 'raw goodness',
            'message-id': 'msg_%d' % (i, )
        }
        ch.basic_publish('howdy there!',
                         exchange='ething',
                         routing_key='notification',
                         properties=props)
        print 'sent/confirmed'
        coro.sleep_relative(1)
    coro.set_exit()