80 lines
2.9 KiB
PHP
80 lines
2.9 KiB
PHP
<?php
|
|
|
|
return [
|
|
'connections' => [
|
|
/**
|
|
* This section helps you to configure
|
|
* RabbitMQ connections for consumers or events
|
|
* publishing.
|
|
*/
|
|
'default' => [
|
|
'host' => env('RABBITMQ_HOST', 'localhost'),
|
|
'port' => env('RABBITMQ_PORT', 5672),
|
|
'user' => env('RABBITMQ_USER', 'guest'),
|
|
'password' => env('RABBITMQ_PASSWORD', 'guest'),
|
|
'vhost' => env('RABBITMQ_VHOST', '/'),
|
|
]
|
|
],
|
|
'message' => [
|
|
/**
|
|
* Serializer converts a PHP object into \PhpAmqpLib\Message\AMQPMessage
|
|
*/
|
|
'serializer' => \Diffhead\PHP\LaravelRabbitMQ\Service\Serializer::class,
|
|
/**
|
|
* Unserializer converts \PhpAmqpLib\Message\AMQPMessage into a PHP array
|
|
*/
|
|
'unserializer' => \Diffhead\PHP\LaravelRabbitMQ\Service\Unserializer::class,
|
|
],
|
|
'event' => [
|
|
/**
|
|
* \Diffhead\PHP\LaravelRabbitMQ\Trait\BroadcastEvent
|
|
*
|
|
* This trait helps you to configure where the event should be broadcasted
|
|
* by default. You can override these settings directly in the event class
|
|
* or globally using environment variables.
|
|
*/
|
|
'defaults' => [
|
|
'connection' => env('RABBITMQ_EVENT_CONNECTION', 'default'),
|
|
'queue' => env('RABBITMQ_EVENT_QUEUE', 'default'),
|
|
'exchange' => env('RABBITMQ_EVENT_EXCHANGE', 'amq.direct'),
|
|
'exchange_type' => env('RABBITMQ_EVENT_EXCHANGE_TYPE', 'direct'),
|
|
'exchange_is_default' => (bool) env('RABBITMQ_EVENT_EXCHANGE_IS_DEFAULT', true),
|
|
'routing_key' => (string) env('RABBITMQ_EVENT_ROUTING_KEY', ''),
|
|
],
|
|
/**
|
|
* \Diffhead\PHP\LaravelRabbitMQ\Listener\PublishEvent
|
|
*
|
|
* This listener publishes events to a rabbitmq bus and
|
|
* does that using laravel queues.
|
|
*
|
|
* You can configure which connection and queue to use for.
|
|
*/
|
|
'publishing' => [
|
|
'connection' => env('RABBITMQ_EVENT_PUBLISHING_CONNECTION', 'sync'),
|
|
'queue' => env('RABBITMQ_EVENT_PUBLISHING_QUEUE', 'default'),
|
|
],
|
|
/**
|
|
* This mapper detects event which should
|
|
* be emitted when RabbitMQ message received.
|
|
*/
|
|
'mapper' => \Diffhead\PHP\LaravelRabbitMQ\Service\EventMapper::class,
|
|
/**
|
|
* Map events with their queues and routing keys.
|
|
*/
|
|
'map' => [
|
|
/**
|
|
* Example:
|
|
*
|
|
* \App\Shared\Event\User\UserCreated::class => [
|
|
* 'queues' => ['portal.calendar.users'],
|
|
* 'routing_keys' => ['user.created'],
|
|
* ],
|
|
* \App\Shared\Event\Meeting\MeetingCreated::class => [
|
|
* 'queues' => ['portal.calendar.meetings'],
|
|
* 'routing_keys' => ['meeting.created'],
|
|
* ],
|
|
*/
|
|
],
|
|
]
|
|
];
|