Example #1
0
def main(spec, content):
    delegate = TwistedDelegate()
    producer = ClientCreator(reactor, AMQClient, delegate=delegate,
        vhost=common.VHOST, spec=spec)
    conn = yield common.getConnection(producer)
    chan = yield common.getChannel(conn)
    yield pushText(chan, content)
    # shut down
    yield cleanUp(conn, chan)
Example #2
0
def main(spec):
    delegate = TwistedDelegate()
    consumer = ClientCreator(reactor, AMQClient, delegate=delegate,
        vhost=common.VHOST, spec=spec)
    conn = yield common.getConnection(consumer)
    chan = yield common.getChannel(conn, common.IS_SERVER)
    queue = yield getQueue(conn, chan)
    loop = True
    while loop:
        loop = yield processMessage(conn, chan, queue)
Example #3
0
def main(spec):
    delegate = TwistedDelegate()
    # create the Twisted producer client
    producer = ClientCreator(
        reactor, AMQClient, delegate=delegate,
        vhost=common.VHOST, spec=spec)
    # connect to the RabbitMQ server
    conn = yield common.getConnection(producer)
    # get the channel
    chan = yield common.getChannel(conn)
    # send the text to the RabbitMQ server
    yield pushText(chan, sys.argv[2])
    # shut everything down
    yield cleanUp(conn, chan)
Example #4
0
def main(spec):
    delegate = TwistedDelegate()
    # create the Twisted consumer client
    consumer = ClientCreator(
        reactor, AMQClient, delegate=delegate,
        vhost=common.VHOST, spec=spec)
    # connect to the RabbitMQ server
    conn = yield common.getConnection(consumer)
    # get the channel
    chan = yield common.getChannel(conn)
    # get the message queue
    queue = yield getQueue(conn, chan)
    while True:
        yield processMessage(chan, queue)