Skip to content

Latest commit

 

History

History
63 lines (49 loc) · 1.53 KB

File metadata and controls

63 lines (49 loc) · 1.53 KB
description Configuring RabbitMQ connection and exchanges in Ecotone

Configuration

Installation

composer require ecotone/amqp

Module Powered By

Enqueue solid and powerful abstraction over asynchronous queues.

Configuration

In order to use AMQP Support we need to add ConnectionFactory to our Dependency Container.

{% tabs %} {% tab title="Symfony" %}

# config/services.yaml
# You need to have RabbitMQ instance running on your localhost, or change DSN
    Enqueue\AmqpExt\AmqpConnectionFactory:
        class: Enqueue\AmqpExt\AmqpConnectionFactory
        arguments:
            - "amqp://guest:guest@localhost:5672//"

{% endtab %}

{% tab title="Laravel" %}

# Register AMQP Service in Provider

use Enqueue\AmqpExt\AmqpConnectionFactory;

public function register()
{
     $this->app->singleton(AmqpConnectionFactory::class, function () {
         return new AmqpConnectionFactory("amqp+lib://guest:guest@localhost:5672//");
     });
}

{% endtab %}

{% tab title="Lite" %}

use Enqueue\AmqpExt\AmqpConnectionFactory;

$application = EcotoneLiteApplication::boostrap(
    [
        AmqpConnectionFactory::class => new AmqpConnectionFactory("amqp+lib://guest:guest@localhost:5672//")
    ]
);

{% endtab %} {% endtabs %}

{% hint style="info" %} We register our AmqpConnection under the class name Enqueue\AmqpExt\AmqpConnectionFactory. This will help Ecotone resolve it automatically, without any additional configuration. {% endhint %}