def main(args, stop=False):
    """
    Arguments parsing, etc..
    """
    daemon = AMQPDaemon(
        con_param=getConParams(
            settings.RABBITMQ_STORAGE_VIRTUALHOST
        ),
        queue=settings.RABBITMQ_STORAGE_INPUT_QUEUE,
        out_exch=settings.RABBITMQ_STORAGE_EXCHANGE,
        out_key=settings.RABBITMQ_STORAGE_OUTPUT_KEY,
        react_fn=reactToAMQPMessage,
        glob=globals()                # used in deserializer
    )

    if not stop and args and args.foreground:  # run at foreground
        daemon.run()
    else:
        daemon.run_daemon()
Arguments parsing, etc..