Example #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
Example #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()
Example #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
Example #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()
Example #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()
Example #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)
Example #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))
Example #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))
Example #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()
Example #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()