def main(args=sys.argv[:]):
    channel = hello_world.get_channel()

    msg = args[1]
    msg_props = pika.BasicProperties()
    msg_props.content_type = 'text/plain'

    channel.basic_publish(body=msg,
                          exchange='hello-exchange',
                          properties=msg_props,
                          routing_key='hola')
    print('published {!r}'.format(msg))

    return 0
def main():
    channel = hello_world.get_channel()

    channel.queue_declare(queue='hello-queue')
    channel.queue_bind(queue='hello-queue',
            exchange='hello-exchange',
            routing_key='hola')

    channel.basic_consume(msg_consumer,
            queue='hello-queue',
            consumer_tag='hello-consumer')

    print('consuming...')
    channel.start_consuming()

    return 0
def main(sysargs=sys.argv[:]):
    msg = sysargs[1]

    logging.basicConfig()

    channel = hello_world.get_channel()

    if channel.basic_publish(
            body=msg,
            exchange='hello-exchange',
            properties=pika.BasicProperties(
                content_type='text/plain',
                delivery_mode=1
            ),
            routing_key='hola',
            mandatory=True):
        print('Message delivered!')
    else:
        print('Message returned!')

    channel.close()

    return 0