Giter VIP home page Giter VIP logo

event-store-bus-bridge's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

event-store-bus-bridge's Issues

3.0.2 Release is a BC-Break

Since we have removed the CausationMetadataEnricherFactory, all applications which uses this factory would be broken on composer update.

EventPublisher should not publish events if event contains errors / exceptions

When using the regular ActionEventEmitterStore (e.g. via MySqlEventStore) any error or exception triggered while recording the event (StreamNotFound, ConcurrentyException, RuntimeException) still causes the respective event to be published.

This seems to be because these exceptions are caught, captured and respective flags set on the event to indicate this error. The EventPublisher in turn doesn't check for these flags but always publishes them.

image

This only seems to be an issue for the ActionEventEmitterEventStore as it dispatches the events right away without rollback.

CausationMetadataEnricher not invoked when command bus is created before event store

The CausationMetadataEnricherFactory is only invoked when the event store is created. Often this is only the case when some command handler requires access to it. Until this is the case, all dispatched commands are not set in the CausationMetadataEnricher, making the first batch of events not having and _causation_id.

Minimal example:

class CreateInternalDirectoryHandler
{
    /** @var  AggregateRepository */
    private $repository;

    public function __construct(AggregateRepository $repository)
    {
        $this->repository = $repository;
    }

    public function handle(CreateInternalDirectory $command)
    {
        $directory = InternalDirectory::create($command->id(), $command->name(), $command->description());

        $this->repository->saveAggregateRoot($directory);
    }
}

// main.php
$commandBus = $serviceManager->get('command_bus_incoming');
$commandBus->dispatch(CreateInternalDirectory::withData(/** .... */));

This will cause the command bus to be created before the event store (which is implicitly created while creating the command handler).
the chain of action is something like this:
create command bus -> dispatch command -> create handler -> create event store -> create enricher plugin -> attach to command bus

Support for configurable causation metadata key

The causation enricher adds the metadata with the key _causation_id:

$message = $message->withAddedMetadata('_causation_id', $this->currentCommand->uuid()->toString());

When using eventstore.org (for example), this needs to be $causationId. We could make this configurable, by injecting the names in the constructor. Alternatively we could introduce something like a Generator with a default and eventstore.org implementation.

Only rollback transaction if in active transaction

If an exception is thrown after event store commit (for example in a projection) then the TransactionManager tries to rollback the transaction again. So the event store throws another exception and the original one is lost.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.