In order for Ecotone
how to route messages you need to register Service Name (Application Name).
- Symfony Service Name Configuration
- Laravel Service Name Configuration
- Ecotone Lite Service Name Configuration
To create AMQP Distributed configuration use Service Context.
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.
This will enable Message Consumer with Service Name, which can consume Distributed Messages:
class MessagingConfiguration
{
#[ServiceContext]
public function distributedConsumer()
{
return AmqpDistributedBusConfiguration::createConsumer();
}
}
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 %}