wwwision/subscription-engine-dcb-adapter

wwwision/dcb-eventstore adapter for wwwision/subscription-engine

1.0.0 2025-06-17 17:10 UTC

This package is auto-updated.

Last update: 2025-07-02 07:26:28 UTC


README

wwwision/dcb-eventstore adapter for wwwision/subscription-engine

Usage

$eventStore = DoctrineEventStore::create($dbalConnection, eventTableName: 'events');

$subscriptionEngine = new SubscriptionEngine(
    eventStoreAdapter: new DcbEventStoreAdapter($eventStore),
    subscriptionStore: new DoctrineSubscriptionStore($dbalConnection, tableName: 'subscriptions'),
    subscribers: Subscribers::fromArray([
        Subscriber::create(
            id: 'some-projection',
            handler: fn (EventEnvelope $eventEnvelope) => print($eventEnvelope->event->type->value),
            reset: fn () => print('resetting projection for replay'),
        ),
        Subscriber::create(
            id: 'some-process',
            handler: fn (EventEnvelope $eventEnvelope) => print('invoking process...'),
            runMode: RunMode::FROM_NOW,
            setup: fn () => print('setting up process...'),
        ),
    ])
);

Contribution

Contributions in the form of issues or pull requests are highly appreciated

License

See LICENSE