PHP code example of hyperlab / laravel-pubsub-rabbitmq
1. Go to this page and download the library: Download hyperlab/laravel-pubsub-rabbitmq 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/ */
hyperlab / laravel-pubsub-rabbitmq example snippets
return [
'rabbitmq' => [
/*
* The name of the RabbitMQ exchange on which the outgoing messages are published.
*/
'exchange' => env('PUBSUB_RABBITMQ_EXCHANGE'),
/*
* The name of the RabbitMQ queue from which the incoming messages are consumed.
*/
'queue' => env('PUBSUB_RABBITMQ_QUEUE'),
],
'queue' => [
/*
* The queue connection that is used to communicate with RabbitMQ.
*/
'connection' => env('PUBSUB_QUEUE_CONNECTION', 'pubsub'),
/*
* The queue worker that you want to consume your incoming messages with.
*
* Valid options are: default, horizon
*/
'worker' => env('PUBSUB_QUEUE_WORKER', 'default'),
],
/*
* The file within your code base that contains the message subscriptions of your application.
*/
'subscriptions' => base_path('routes/subscriptions.php'),
];
class HandleUserCreatedMessage
{
public function __invoke(\Hyperlab\LaravelPubSubRabbitMQ\Subscriber\Message $message): void
{
//
}
}
class HandleUserCreatedMessage
{
public function handle(\Hyperlab\LaravelPubSubRabbitMQ\Subscriber\Message $message): void
{
//
}
}
class HandleUserCreatedMessage
{
public function execute(\Hyperlab\LaravelPubSubRabbitMQ\Subscriber\Message $message): void
{
//
}
}