Ecotone
SponsorBlogGithubSupport and ContactCommunity Channel
  • About
  • Installation
  • How to use
    • CQRS PHP
    • Event Handling PHP
    • Aggregates & Sagas
    • Scheduling in PHP
    • Asynchronous PHP
    • Event Sourcing PHP
    • Microservices PHP
    • Resiliency and Error Handling
    • Laravel Demos
    • Symfony Demos
      • Doctrine ORM
  • Tutorial
    • Before we start tutorial
    • Lesson 1: Messaging Concepts
    • Lesson 2: Tactical DDD
    • Lesson 3: Converters
    • Lesson 4: Metadata and Method Invocation
    • Lesson 5: Interceptors
    • Lesson 6: Asynchronous Handling
  • Enterprise
  • Modelling
    • Introduction
    • Message Bus and CQRS
      • CQRS Introduction - Commands
        • Query Handling
        • Event Handling
      • Aggregate Introduction
        • Aggregate Command Handlers
        • Aggregate Query Handlers
        • Aggregate Event Handlers
        • Advanced Aggregate creation
      • Repositories Introduction
      • Business Interface
        • Introduction
        • Business Repository
        • Database Business Interface
          • Converting Parameters
          • Converting Results
      • Saga Introduction
      • Identifier Mapping
    • Extending Messaging (Middlewares)
      • Message Headers
      • Interceptors (Middlewares)
        • Additional Scenarios
      • Intercepting Asynchronous Endpoints
      • Extending Message Buses (Gateways)
    • Event Sourcing
      • Installation
      • Event Sourcing Introduction
        • Working with Event Streams
        • Event Sourcing Aggregates
          • Working with Aggregates
          • Applying Events
          • Different ways to Record Events
        • Working with Metadata
        • Event versioning
        • Event Stream Persistence
          • Event Sourcing Repository
          • Making Stream immune to changes
          • Snapshoting
          • Persistence Strategies
          • Event Serialization and PII Data (GDPR)
      • Projection Introduction
        • Configuration
        • Choosing Event Streams for Projection
        • Executing and Managing
          • Running Projections
          • Projection CLI Actions
          • Access Event Store
        • Projections with State
        • Emitting events
    • Recovering, Tracing and Monitoring
      • Resiliency
        • Retries
        • Error Channel and Dead Letter
          • Dbal Dead Letter
        • Idempotent Consumer (Deduplication)
        • Resilient Sending
        • Outbox Pattern
        • Concurrency Handling
      • Message Handling Isolation
      • Ecotone Pulse (Service Dashboard)
    • Asynchronous Handling and Scheduling
      • Asynchronous Message Handlers
      • Asynchronous Message Bus (Gateways)
      • Delaying Messages
      • Time to Live
      • Message Priority
      • Scheduling
      • Dynamic Message Channels
    • Distributed Bus and Microservices
      • Distributed Bus
        • Distributed Bus with Service Map
          • Configuration
          • Custom Features
          • Non-Ecotone Application integration
          • Testing
        • AMQP Distributed Bus (RabbitMQ)
          • Configuration
        • Distributed Bus Interface
      • Message Consumer
      • Message Publisher
    • Business Workflows
      • The Basics - Stateless Workflows
      • Stateful Workflows - Saga
      • Handling Failures
    • Testing Support
      • Testing Messaging
      • Testing Aggregates and Sagas with Message Flows
      • Testing Event Sourcing Applications
      • Testing Asynchronous Messaging
  • Messaging and Ecotone In Depth
    • Overview
    • Multi-Tenancy Support
      • Getting Started
        • Any Framework Configuration
        • Symfony and Doctrine ORM
        • Laravel
      • Different Scenarios
        • Hooking into Tenant Switch
        • Shared and Multi Database Tenants
        • Accessing Current Tenant in Message Handler
        • Events and Tenant Propagation
        • Multi-Tenant aware Dead Letter
      • Advanced Queuing Strategies
    • Document Store
    • Console Commands
    • Messaging concepts
      • Message
      • Message Channel
      • Message Endpoints/Handlers
        • Internal Message Handler
        • Message Router
        • Splitter
      • Consumer
      • Messaging Gateway
      • Inbound/Outbound Channel Adapter
    • Method Invocation And Conversion
      • Method Invocation
      • Conversion
        • Payload Conversion
        • Headers Conversion
    • Service (Application) Configuration
    • Contributing to Ecotone
      • How Ecotone works under the hood
      • Ecotone Phases
      • Registering new Module Package
      • Demo Integration with SQS
        • Preparation
        • Inbound and Outbound Adapters and Message Channel
        • Message Consumer and Publisher
  • Modules
    • Overview
    • Symfony
      • Symfony Configuration
      • Symfony Database Connection (DBAL Module)
      • Doctrine ORM
      • Symfony Messenger Transport
    • Laravel
      • Laravel Configuration
      • Database Connection (DBAL Module)
      • Eloquent
      • Laravel Queues
      • Laravel Octane
    • Ecotone Lite
      • Logging
      • Database Connection (DBAL Module)
    • JMS Converter
    • OpenTelemetry (Tracing and Metrics)
      • Configuration
    • RabbitMQ Support
    • Kafka Support
      • Configuration
      • Message partitioning
      • Usage
    • DBAL Support
    • Amazon SQS Support
    • Redis Support
  • Other
    • Contact, Workshops and Support
Powered by GitBook
On this page
  • Difference between Service Map and Amqp Bus Module
  • How Command Distribution works
  • How Event Distribution works

Was this helpful?

Export as PDF
  1. Modelling
  2. Distributed Bus and Microservices
  3. Distributed Bus

AMQP Distributed Bus (RabbitMQ)

PreviousTestingNextConfiguration

Last updated 3 months ago

Was this helpful?

In case of RabbitMQ, Ecotone will create specific income queue for each Consuming Distributed Service (with by default the name of the service).

From application perspective all we need to do, is to provide channel implementation. Ecotone will take care of whole publishing and consuming part.

Difference between Service Map and Amqp Bus Module

Ecotone provides done on the Application level. This alternative can also be used with RabbitMQ integration. The main difference is on how the routing is done. In case of AMQP Distributed Bus routing is pushed to RabbitMQ, and whenever Distributed Handler is added, Ecotone's Message Consumer will add the bindings to related queues. On other hand with Service Map routing is done on the Application level, therefore it leave more space to Developers to make adjustments. AMQP Distributed Bus

  • Routing is done on the RabbitMQ level, bindings are set up automatically by running Message Consumer.

  • It does not track of stale Event related bindings. Therefore it may still push Event to specific Service even so it's not interested anymore. However this is safe as this Event will be simply ignored.

  • It requires single entrypoint queue per Service, which can't be shared for anything else

Distributed Bus with Service Map

  • Routing is done on the Application level when Message is sent.

  • No stale bindings configuration, as it always sends accordingly to the Service Map.

  • Queue can be reused for distribution and asynchronous application level processing

  • Separate Queues for Event, Commands or even per Message can be introduced

  • Ability to test Publishers and Consumers with In Memory implementations

  • Depending on the configuration, for Events it may require more than one Message sending to publish the Message

Service Map should be treated as preferred alternative as it provides more options, however AMQP Distributed Bus can be considered if we require to do the routing on the Message Broker level.

How Command Distribution works

Distribution for Command and Generic Messages works by binding to the Service Name from distributed exchange. Ecotone registers distributed exchange automatically, and make use of it for Message forwarding between Services.

When we are sending Distributed Command we are stating which Service do we target.

interface DistributedBus
{
    public function sendCommand(
        string $targetServiceName, 
        (...)

This way Ecotone knows where to send this Message too. Consumer on other hand automatically binds by Service Name to it's private queue. This way two sides can connect in seamless way.

How Event Distribution works

In case of Events we don't target specific Service when the Event is being sent. Publisher is unaware of Services interested in the Event, it simply states that given fact has happened and publishes it. Therefore the routing part does happen on the side of the Consumers.

Whenever we run Distributed Message Consumer it already knows which distributed Events it's interested in.

#[Distributed]
#[EventHandler("billing.detailsWereChanged")]
public function registerTicket(BillingDetailsWereChanged $event) : void

This way Ecotone knows which binding to create. So whenever given Event it will be able to be delivered to the correct interested Service.

Distributed Bus with Service Map
Distributed Command is routed by Service Name to given Service
Distributed Publisher send an Event Message and each interested Service can subscribe to it