def main(args, stop=False):
    """
    Arguments parsing, etc..
    """
    daemon = AMQPDaemon(
        con_param=getConParams(
            settings.RABBITMQ_ALEPH_LINK_EXPORT_VIRTUALHOST
        ),
        queue=settings.RABBITMQ_ALEPH_LINK_EXPORT_INPUT_QUEUE,
        out_exch=settings.RABBITMQ_ALEPH_LINK_EXPORT_EXCHANGE,
        out_key=settings.RABBITMQ_ALEPH_LINK_EXPORT_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()