How to embed and initialize RabbitMQ consumer

Re: How to embed and initialize RabbitMQ consumer

by Zoran Jeremic -
Number of replies: 0

I finally found solution that works for me. It looks like:

function async_curl($background_process=''){

    //-------------get curl contents----------------

    $ch = curl_init($background_process);
    curl_setopt_array($ch, array(
        CURLOPT_HEADER => 0,
        CURLOPT_RETURNTRANSFER =>true,
        CURLOPT_NOSIGNAL => 1, //to timeout immediately if the value is < 1000 ms
        CURLOPT_TIMEOUT_MS => 50, //The maximum number of mseconds to allow cURL functions to execute
        CURLOPT_VERBOSE => 1,
        CURLOPT_HEADER => 1
    ));
    $out = curl_exec($ch);
    curl_close($ch);
    return true;
}

//...
$url=$CFG->wwwroot.'/local/morph/trigger_rabbitmq_consumer.php'; async_curl(
$url);
I don't know if there are better solutions, but this one is the only I could find that works.

Thanks,
Zoran