Skip to content

Latest commit

 

History

History
103 lines (81 loc) · 2.27 KB

File metadata and controls

103 lines (81 loc) · 2.27 KB

Configuration

Service Name Configuration

In order for Ecotone how to route messages you need to register Service Name (Application Name).

Configure Distribution

To create AMQP Distributed configuration use Service Context.

Distributed Message Publisher

This will register DistributedBus in Dependency Container, which can be used to send Distributed Messages:

class MessagingConfiguration
{
    #[ServiceContext] 
    public function distributedPublisher()
    {
        return AmqpDistributedBusConfiguration::createPublisher();
    }
}

After that DistributedBus will become available in Dependency Container, ready to start sending Messages.

Distributed Message Consumer

This will enable Message Consumer with Service Name, which can consume Distributed Messages:

class MessagingConfiguration
{
    #[ServiceContext] 
    public function distributedConsumer()
    {
        return AmqpDistributedBusConfiguration::createConsumer();
    }
}

Run the consumer

Run consumer for your registered distributed consumer. It will be available under your Service Name

List:

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

bin/console ecotone:list
+--------------------+
| Endpoint Names     |
+--------------------+
| billing            |
+--------------------+

{% endtab %}

{% tab title="Laravel" %}

artisan ecotone:list
+--------------------+
| Endpoint Names     |
+--------------------+
| billing            |
+--------------------+

{% endtab %}

{% tab title="Lite" %}

$consumers = $messagingSystem->list()

{% endtab %} {% endtabs %}

Run it:

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

bin/console ecotone:run billing -vvv

{% endtab %}

{% tab title="Laravel" %}

artisan ecotone:run billing -vvv

{% endtab %}

{% tab title="Lite" %}

$messagingSystem->run("billing");

{% endtab %} {% endtabs %}