コード例 #1
0
def t0():
    c = amqp.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
コード例 #2
0
ファイル: rpc_server.py プロジェクト: amitdev/shrapnel
def t0():
    c = amqp.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
コード例 #3
0
ファイル: t2.py プロジェクト: amitdev/shrapnel
def t2():
    global c
    c = amqp.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()
コード例 #4
0
def t2():
    global c
    c = amqp.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()
コード例 #5
0
ファイル: rpc_client.py プロジェクト: amitdev/shrapnel
def t0():
    c = amqp.client (('guest', 'guest'), '127.0.0.1', heartbeat=30)
    c.go()
    ch = c.channel()
    rpc = amqp.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)
コード例 #6
0
def t0():
    c = amqp.client(('guest', 'guest'), '127.0.0.1', heartbeat=30)
    c.go()
    ch = c.channel()
    rpc = amqp.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)
コード例 #7
0
ファイル: t0.py プロジェクト: amitdev/shrapnel
def t0():
    c = amqp.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))
コード例 #8
0
def t0():
    c = amqp.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))
コード例 #9
0
ファイル: t3.py プロジェクト: amitdev/shrapnel
def t3():
    global c
    c = amqp.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()
コード例 #10
0
def t3():
    global c
    c = amqp.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()