Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

A repository for EventSauce that connects to a Prooph Event Store

Notifications You must be signed in to change notification settings

patrickkusebauch/event-sauce-prooph-event-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

event-sauce-prooph-event-store

A repository for EventSauce that connects to a Prooph Event Store.

Why?

Prooph components are very opiniated about how you should write your code.

Most of the components for event-sourcing are deprecated now and so not work with the few component that are still being developed and are maintained.

One of the few that are still maintained is the interface forpersistance into an event store. With it also many implememntations like PDO and Event Store database. Furthermore they offer several useful strategies for segmentation of events in the event store.

Therefore it is useful to do your event sourcing with EventSauce and to your event storage with Prooph. This library offers you just that. Take advantage of Prooph comprehensive persistance layer.

Usage

function createInGeneral(): \EventSauce\EventSourcing\AggregateRootRepository
{
    /** @var \Prooph\EventStore\EventStore $eventStore */
    // Your Event Store has implementation has to use EventSauceMessageFactory to create messages from data!!

    $configuredEventStore = new ConfiguredEventStore($eventStore);
    return new ProophEventStoreRepository(\EventSauce\EventSourcing\AggregateRoot::class, $configuredEventStore);
}

function createConcreteExample(): \EventSauce\EventSourcing\AggregateRootRepository
{
    $eventStore = new \Prooph\EventStore\Pdo\PostgresEventStore(
        new EventSauceMessageFactory(), // Your Event Store has to use this class to create messages from data!!
        new \PDO('you know how to configure a PDO connection, don\'t you?'),
        new \Prooph\EventStore\Pdo\PersistenceStrategy\PostgresAggregateStreamStrategy()
    );

    $configuredEventStore = new ConfiguredEventStore($eventStore, true);
    return new ProophEventStoreRepository(\EventSauce\EventSourcing\AggregateRoot::class, $configuredEventStore);
}

function createFullConfig(): \EventSauce\EventSourcing\AggregateRootRepository
{
    /** @var \Prooph\EventStore\EventStore $eventStore */
    // Your Event Store has implementation has to use EventSauceMessageFactory to create messages from data!!

    $configuredEventStore = new ConfiguredEventStore($eventStore, false, ['stream_tag' => 'banana'], new
    \Prooph\EventStore\StreamName('lama'));
    return new ProophEventStoreRepository(\EventSauce\EventSourcing\AggregateRoot::class, $configuredEventStore, new
    \EventSauce\EventSourcing\CollectingMessageDispatcher(), new \EventSauce\EventSourcing\DefaultHeadersDecorator());
}

About

A repository for EventSauce that connects to a Prooph Event Store

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages