2017 © Pedro Peláez
 

library event-rabbitmq

image

xervice/event-rabbitmq

  • Monday, July 30, 2018
  • by mibexx
  • Repository
  • 1 Watchers
  • 0 Stars
  • 39 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

EventRabbitMq

Build Status Scrutinizer Code Quality Code Coverage, (*1)

Installation

composer require xervice/event-rabbitmq

Configuration

To use RabbitMQ as event handler, you have to overwrite the event factory., (*2)

EventFactory, (*3)

<?php

namespace App\Event;

use Xervice\Event\EventFactory as XerviceEventFactory;
use Xervice\EventRabbitMq\Business\EventProvider\RabbitMqEventProvider;
use Xervice\Event\Business\Provider\EventProviderInterface;

class EventFactory extends XerviceEventFactory
{
    /**
     * @return \Xervice\Event\Business\Provider\EventProviderInterface
     */
    public function createEventProvider(): EventProviderInterface
    {
        return new RabbitMqEventProvider();
    }
}

Also you have to overwrite the RabbitMQDependencyProvider to define the Queue, Exchange and Listener to RabbitMQ., (*4)

RabbitMQDependencyProvider, (*5)

<?php

namespace App\RabbitMQ;

use Xervice\RabbitMQ\RabbitMQDependencyProvider as XerviceRabbitMQDependencyProvider;
use Xervice\EventRabbitMq\Business\Listener\QueueListener;
use Xervice\EventRabbitMq\Business\Queue\EventQueue;
use Xervice\EventRabbitMq\Business\Queue\EventExchange;

class RabbitMQDependencyProvider extends XerviceRabbitMQDependencyProvider
{
    /**
     * @return array
     */
    protected function getListener()
    {
        return [
            new QueueListener()
        ];
    }

    /**
     * @return \Xervice\RabbitMQ\Queue\QueueInterface[]
     */
    protected function getQueues()
    {
        return [
            new EventQueue()
        ];
    }

    /**
     * @return \Xervice\RabbitMQ\Exchange\ExchangeInterface[]
     */
    protected function getExchanges()
    {
        return [
            new EventExchange()
        ];
    }
}

Using

There is no special using. After the configuration, all Events should be provided to RabbitMQ., (*6)

The Versions

30/07 2018
30/07 2018
28/07 2018
27/07 2018