andy-thorne/domain-events-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Domain events for Doctrine ODM and ORM

Maintainers

👁 andythorne

Package info

github.com/andythorne/domain-events

Type:symfony-bundle

pkg:composer/andy-thorne/domain-events-bundle

Statistics

Installs: 536

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.0 2022-01-11 12:46 UTC

Requires

Suggests

Provides

None

Conflicts

None

Replaces

None

MIT a6f98a586e5fcd3529dffb05d9bc682538049124

  • Andy Thorne <andy.woop@andy-thorne.co.uk>

This package is auto-updated.

Last update: 2024-12-18 08:34:39 UTC


README

This bundle adds Domain Event dispatching on doctrine events via a MessageBus.

👁 CI

Installation

composer require andy-thorne/domain-events-bundle

Configuration

# Defaults
domain_events:
 orm: true
 odm: false
 bus: domain_event.bus
 transport: async_domain_events
 configure_routing: true # Auto-configures messenger routing for DomainEventInterfaces to route to the configured transport

framework:
 messenger:
 transports:
 async_domain_events: "%env(ASYNC_MESSENGER_TRANSPORT_DSN)%"

The bundle will also configure these messenger settings based on your domain_events config. If you already have buses configured, you will need to specify a framework.messenger.default_bus.

# The bundle also configures your
framework:
 messenger:
 # Set up a bus that will allows no handlers
 buses:
 <domain_events.bus>:
 default_middleware: allow_no_handlers

 # Route all domain events to the domain event transport if configure_routing is true (default)
 routing:
 'AndyThorne\Components\DomainEventsBundle\Events\DomainEventInterface': <domain_events.transport>

Message Bus

Domain Events uses the app's MessageBus to transport domain events. The default Messenger Component is configured to be synchronous and requires at least one handler to be defined for each Message. For Domain Events to work, we need to configure an asynchronous MessageBus and allow it to have no handlers:

Why Asynchronous?

Domain Events are dispatched within a doctrine postFlush lifecycle event