PHP code example of proklung / bitrix.rabbitmq.module
1. Go to this page and download the library: Download proklung/bitrix.rabbitmq.module 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/ */
proklung / bitrix.rabbitmq.module example snippets
return [
'parameters' => [
'value' => [
'cache_path' => '/bitrix/cache/s1/proklung.rabbitmq', // Путь к закешированному контейнеру
'compile_container_envs' => ['dev', 'prod'], // Окружения при которых компилировать контейнер
'container.dumper.inline_factories' => false, // Дампить контейнер как одиночные файлы
],
'readonly' => false,
]
];
// UploadPictureConsumer.php
use Proklung\RabbitMq\RabbitMq\ConsumerInterface;
use PhpAmqpLib\Message\AMQPMessage;
class UploadPictureConsumer implements ConsumerInterface
{
public function execute(AMQPMessage $msg)
{
echo ' [x] Received ', $msg->body, "\n";
}
}
use PhpAmqpLib\Message\AMQPMessage;
class RandomIntServer
{
public function execute(AMQPMessage $request)
{
$params = json_decode($request->getBody(), true);
return ['request_id' => mt_rand(1, 123)];
}
}