PHP code example of romainrg / rabbitmq_client
1. Go to this page and download the library: Download romainrg/rabbitmq_client library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
romainrg / rabbitmq_client example snippets
$config['composer_autoload'] = FCPATH.'vendor/autoload.php';
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Config for Rabbit MQ Library
*/
$config['rabbitmq'] = array(
'host' => 'localhost', // <- Your Host (default: localhost)
'port' => 5672, // <- Your Port (default: 5672)
'user' => 'username', // <- Your User (default: guest)
'pass' => 'password', // <- Your Password (default: guest)
'vhost' => '/', // <- Your Vhost (default: /)
'allowed_methods' => null, // <- Allowed methods (default: null)
'non_blocking' => false, // <- Your Host (default: false)
'timeout' => 0 // <- Timeout (default: 0)
);
$this->load->add_package_path(APPPATH . 'third_party/rabbitmq');
$this->load->library('rabbitmq');
$this->load->remove_package_path(APPPATH . 'third_party/rabbitmq');
$this->rabbitmq->push('hello_queue', 'Hello World !');
return $this->rabbitmq->pull('hello_queue', true, array($this, '_process'));
$this->rabbitmq->push('hello_queue', 'Hello World !', TRUE, array('delivery_mode' => 2));
sh
$ php www.mywebsite.com/index.php 'controller' 'method'
sh
$ php www.mywebsite.com/index.php 'controller' 'method'