Skip to content

Commit

Permalink
rename projection into subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBadura committed Mar 8, 2024
1 parent 6886ad6 commit 23fc743
Show file tree
Hide file tree
Showing 127 changed files with 5,204 additions and 5,299 deletions.
81 changes: 35 additions & 46 deletions baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
<code><![CDATA[$method->getName()]]></code>
</MixedMethodCall>
</file>
<file src="src/EventBus/Serializer/EventSerializerMessageSerializer.php">
<MixedArgumentTypeCoercion>
<code><![CDATA[$messageData['headers']]]></code>
</MixedArgumentTypeCoercion>
</file>
<file src="src/Metadata/AggregateRoot/AggregateRootMetadataAwareMetadataFactory.php">
<InvalidReturnStatement>
<code><![CDATA[$aggregate::metadata()]]></code>
Expand All @@ -44,29 +39,6 @@
<code><![CDATA[AggregateRootMetadata<T>]]></code>
</InvalidReturnType>
</file>
<file src="src/Projection/Projection/Store/DoctrineStore.php">
<MixedArgument>
<code><![CDATA[$context]]></code>
</MixedArgument>
<MixedAssignment>
<code><![CDATA[$context]]></code>
</MixedAssignment>
<PossiblyNullPropertyFetch>
<code><![CDATA[$projectionError->errorContext]]></code>
<code><![CDATA[$projectionError->errorContext]]></code>
</PossiblyNullPropertyFetch>
</file>
<file src="src/Projection/Projector/MetadataProjectorAccessor.php">
<MixedMethodCall>
<code><![CDATA[$method]]></code>
<code><![CDATA[$method]]></code>
<code><![CDATA[$method]]></code>
</MixedMethodCall>
<MixedReturnTypeCoercion>
<code><![CDATA[$this->projector->$method(...)]]></code>
<code><![CDATA[Closure(Message):void]]></code>
</MixedReturnTypeCoercion>
</file>
<file src="src/Repository/DefaultRepository.php">
<PropertyTypeCoercion>
<code><![CDATA[new WeakMap()]]></code>
Expand All @@ -93,21 +65,35 @@
<code><![CDATA[array<string, string>]]></code>
</MixedReturnTypeCoercion>
</file>
<file src="src/Subscription/Store/DoctrineSubscriptionStore.php">
<MixedArgument>
<code><![CDATA[$context]]></code>
</MixedArgument>
<MixedAssignment>
<code><![CDATA[$context]]></code>
</MixedAssignment>
<PossiblyNullPropertyFetch>
<code><![CDATA[$subscriptionError->errorContext]]></code>
<code><![CDATA[$subscriptionError->errorContext]]></code>
</PossiblyNullPropertyFetch>
</file>
<file src="src/Subscription/Subscriber/MetadataSubscriberAccessor.php">
<MixedMethodCall>
<code><![CDATA[$method]]></code>
<code><![CDATA[$method]]></code>
<code><![CDATA[$method]]></code>
</MixedMethodCall>
<MixedReturnTypeCoercion>
<code><![CDATA[$this->subscriber->$method(...)]]></code>
<code><![CDATA[Closure(Message):void]]></code>
</MixedReturnTypeCoercion>
</file>
<file src="tests/Benchmark/BasicImplementation/Aggregate/Profile.php">
<PropertyNotSetInConstructor>
<code><![CDATA[$id]]></code>
<code><![CDATA[$name]]></code>
</PropertyNotSetInConstructor>
</file>
<file src="tests/Benchmark/ProjectionistBench.php">
<MissingConstructor>
<code><![CDATA[$bus]]></code>
<code><![CDATA[$id]]></code>
<code><![CDATA[$projectionist]]></code>
<code><![CDATA[$repository]]></code>
<code><![CDATA[$store]]></code>
</MissingConstructor>
</file>
<file src="tests/Benchmark/SimpleSetupBench.php">
<MissingConstructor>
<code><![CDATA[$bus]]></code>
Expand Down Expand Up @@ -137,6 +123,15 @@
<code><![CDATA[$store]]></code>
</MissingConstructor>
</file>
<file src="tests/Benchmark/SubscriptionEngineBench.php">
<MissingConstructor>
<code><![CDATA[$bus]]></code>
<code><![CDATA[$id]]></code>
<code><![CDATA[$repository]]></code>
<code><![CDATA[$store]]></code>
<code><![CDATA[$subscriptionEngine]]></code>
</MissingConstructor>
</file>
<file src="tests/Integration/BankAccountSplitStream/Aggregate/BankAccount.php">
<PropertyNotSetInConstructor>
<code><![CDATA[$balanceInCents]]></code>
Expand All @@ -150,26 +145,20 @@
<code><![CDATA[$name]]></code>
</PropertyNotSetInConstructor>
</file>
<file src="tests/Integration/Outbox/Aggregate/Profile.php">
<PropertyNotSetInConstructor>
<code><![CDATA[$id]]></code>
<code><![CDATA[$name]]></code>
</PropertyNotSetInConstructor>
</file>
<file src="tests/Integration/Pipeline/Aggregate/Profile.php">
<PropertyNotSetInConstructor>
<code><![CDATA[$id]]></code>
<code><![CDATA[$privacy]]></code>
<code><![CDATA[$visited]]></code>
</PropertyNotSetInConstructor>
</file>
<file src="tests/Integration/Projectionist/Aggregate/Profile.php">
<file src="tests/Integration/Store/Profile.php">
<PropertyNotSetInConstructor>
<code><![CDATA[$id]]></code>
<code><![CDATA[$name]]></code>
</PropertyNotSetInConstructor>
</file>
<file src="tests/Integration/Store/Profile.php">
<file src="tests/Integration/Subscription/Aggregate/Profile.php">
<PropertyNotSetInConstructor>
<code><![CDATA[$id]]></code>
<code><![CDATA[$name]]></code>
Expand Down Expand Up @@ -247,7 +236,7 @@
<code><![CDATA[next]]></code>
</InvalidMethodCall>
</file>
<file src="tests/Unit/Projection/Projectionist/DefaultProjectionistTest.php">
<file src="tests/Unit/Subscription/Engine/DefaultSubscriptionEngineTest.php">
<PossiblyUndefinedArrayOffset>
<code><![CDATA[$update1]]></code>
</PossiblyUndefinedArrayOffset>
Expand Down
3 changes: 1 addition & 2 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ nav:
- Repository: repository.md
- Store: store.md
- Event Bus: event_bus.md
- Processor: processor.md
- Projection: projection.md
- Subscription: subscription.md
- Advanced:
- Aggregate ID: aggregate_id.md
- Normalizer: normalizer.md
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/aggregate.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ final class Profile extends BasicAggregateRoot
## Suppress missing apply methods

Sometimes you have events that do not change the state of the aggregate itself,
but are still recorded for the future, to listen on it or to create a projection.
but are still recorded for the future or to subscribe for processor and projection.
So that you are not forced to write an apply method for it,
you can suppress the missing apply exceptions these events with the `SuppressMissingApply` attribute.

Expand Down Expand Up @@ -518,8 +518,8 @@ This is not a problem, as the `apply` methods are always executed immediately.

In the next case we throw an exception if the hotel is already overbooked.
Besides that, we record another event `FullyBooked`, if the hotel is fully booked with the last booking.
With this event we could [notify](./processor.md) external systems
or fill a [projection](./projection.md) with fully booked hotels.
With this event we could [notify](./subscription.md) external systems
or fill a [projection](./subscription.md) with fully booked hotels.

```php
use Patchlevel\EventSourcing\Aggregate\BasicAggregateRoot;
Expand Down Expand Up @@ -660,5 +660,5 @@ $aggregateRegistry = (new AttributeEventRegistryFactory())->create($paths);
* [How to create own aggregate id](aggregate_id.md)
* [How to store and load aggregates](repository.md)
* [How to snapshot aggregates](snapshots.md)
* [How to create Projections](projection.md)
* [How to create Projections](subscription.md)
* [How to split streams](split_stream.md)
39 changes: 19 additions & 20 deletions docs/pages/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You can:

* Create and delete `databases`
* Create, update and delete `schemas`
* Manage `projections`
* Manage `subscriptions`

## Database commands

Expand All @@ -27,22 +27,21 @@ The database schema can also be created, updated and dropped.

You can also register doctrine migration commands.

## Projection commands
## Subscription commands

To manage your projectors there are the following cli commands.
To manage your subscriptions there are the following cli commands.

* ProjectionBootCommand: `event-sourcing:projection:boot`
* ProjectionPauseCommand: `event-sourcing:projection:pause`
* ProjectionReactiveCommand: `event-sourcing:projection:reactive`
* ProjectionRebuildCommand: `event-sourcing:projection:rebuild`
* ProjectionRemoveCommand: `event-sourcing:projection:remove`
* ProjectionRunCommand: `event-sourcing:projection:run`
* ProjectionStatusCommand: `event-sourcing:projection:status`
* ProjectionTeardownCommand: `event-sourcing:projection:teardown`
* SubscriptionBootCommand: `event-sourcing:subscription:boot`
* SubscriptionPauseCommand: `event-sourcing:subscription:pause`
* SubscriptionReactiveCommand: `event-sourcing:subscription:reactive`
* SubscriptionRemoveCommand: `event-sourcing:subscription:remove`
* SubscriptionRunCommand: `event-sourcing:subscription:run`
* SubscriptionStatusCommand: `event-sourcing:subscription:status`
* SubscriptionTeardownCommand: `event-sourcing:subscription:teardown`

!!! note

You can find out more about projections [here](projection.md).
You can find out more about subscriptions [here](subscription.md).

## Inspector commands

Expand Down Expand Up @@ -74,14 +73,14 @@ $schemaManager = new DoctrineSchemaManager();
$cli->addCommands(array(
new Command\DatabaseCreateCommand($store, $doctrineHelper),
new Command\DatabaseDropCommand($store, $doctrineHelper),
new Command\ProjectionBootCommand($projectionist),
new Command\ProjectionPauseCommand($projectionist),
new Command\ProjectionRunCommand($projectionist),
new Command\ProjectionTeardownCommand($projectionist),
new Command\ProjectionRemoveCommand($projectionist),
new Command\ProjectionReactivateCommand($projectionist),
new Command\ProjectionRebuildCommand($projectionist),
new Command\ProjectionStatusCommand($projectionist),
new Command\SubscriptionBootCommand($projectionist),
new Command\SubscriptionPauseCommand($projectionist),
new Command\SubscriptionRunCommand($projectionist),
new Command\SubscriptionTeardownCommand($projectionist),
new Command\SubscriptionRemoveCommand($projectionist),
new Command\SubscriptionReactivateCommand($projectionist),
new Command\SubscriptionRebuildCommand($projectionist),
new Command\SubscriptionStatusCommand($projectionist),
new Command\SchemaCreateCommand($store, $schemaManager),
new Command\SchemaDropCommand($store, $schemaManager),
new Command\SchemaUpdateCommand($store, $schemaManager),
Expand Down
5 changes: 2 additions & 3 deletions docs/pages/event_bus.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,5 @@ $eventBus = new Psr14EventBus($psr14EventDispatcher);

* [How to decorate messages](message_decorator.md)
* [How to use outbox pattern](outbox.md)
* [How to use processor](processor.md)
* [How to use projections](projection.md)
* [How to debug messages with the watch server](watch_server.md)
* [How to use processor](subscription.md)
* [How to use subscriptions](subscription.md)
33 changes: 16 additions & 17 deletions docs/pages/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,22 +154,21 @@ final class Hotel extends BasicAggregateRoot

So that we can see all the hotels on our website and also see how many guests are currently visiting the hotels,
we need a projection for it. To create a projection we need a projector.
Each projector is then responsible for a specific projection and version.
Each subscriber is then responsible for a specific projection.

```php
use Doctrine\DBAL\Connection;
use Patchlevel\EventSourcing\Attribute\Setup;
use Patchlevel\EventSourcing\Attribute\Teardown;
use Patchlevel\EventSourcing\Attribute\Subscribe;
use Patchlevel\EventSourcing\Attribute\Projector;
use Patchlevel\EventSourcing\Attribute\Subscriber;
use Patchlevel\EventSourcing\EventBus\Message;
use Patchlevel\EventSourcing\Projection\Projection\ProjectionId;
use Patchlevel\EventSourcing\Projection\Projector\ProjectorUtil;
use Patchlevel\EventSourcing\Subscription\Subscriber\SubscriberUtil;

#[Projector('hotel')]
#[Subscriber('hotel')]
final class HotelProjector
{
use ProjectorUtil;
use SubscriberUtil;

public function __construct(
private readonly Connection $db
Expand Down Expand Up @@ -231,14 +230,14 @@ final class HotelProjector

private function table(): string
{
return 'projection_' . $this->projectorId();
return 'projection_' . $this->subscriberId();
}
}
```

!!! note

You can find out more about projections [here](projection.md).
You can find out more about subscriptions [here](subscription.md).

## Processor

Expand Down Expand Up @@ -270,7 +269,7 @@ final class SendCheckInEmailProcessor

!!! note

You can find out more about processor [here](processor.md).
You can find out more about processor [here](subscription.md).

## Configuration

Expand All @@ -279,9 +278,9 @@ After we have defined everything, we still have to plug the whole thing together
```php
use Doctrine\DBAL\DriverManager;
use Patchlevel\EventSourcing\EventBus\DefaultEventBus;
use Patchlevel\EventSourcing\Projection\Projection\Store\DoctrineStore;
use Patchlevel\EventSourcing\Projection\Projectionist\DefaultProjectionist;
use Patchlevel\EventSourcing\Projection\Projector\MetadataProjectorAccessorRepository;
use Patchlevel\EventSourcing\Projection\Engine\DefaultSubscriptionEngine;
use Patchlevel\EventSourcing\Projection\Subscriber\MetadataSubscriberAccessorRepository;
use Patchlevel\EventSourcing\Projection\Store\DoctrineSubscriptionStore;
use Patchlevel\EventSourcing\Repository\DefaultRepositoryManager;
use Patchlevel\EventSourcing\Serializer\DefaultEventSerializer;
use Patchlevel\EventSourcing\Store\DoctrineDbalStore;
Expand All @@ -307,13 +306,13 @@ $eventStore = new DoctrineDbalStore(

$hotelProjector = new HotelProjector($projectionConnection);

$projectorRepository = new MetadataProjectorAccessorRepository([
$projectorRepository = new MetadataSubscriberAccessorRepository([
$hotelProjector,
]);

$projectionStore = new DoctrineStore($connection);
$projectionStore = new DoctrineSubscriptionStore($connection);

$projectionist = new DefaultProjectionist(
$projectionist = new DefaultSubscriptionEngine(
$eventStore,
$projectionStore,
$projectorRepository,
Expand Down Expand Up @@ -407,6 +406,6 @@ $hotels = $hotelProjection->getHotels();
* [How to create an aggregate](aggregate.md)
* [How to create an event](events.md)
* [How to store aggregates](repository.md)
* [How to process events](processor.md)
* [How to create a projection](projection.md)
* [How to process events](subscription.md)
* [How to create a projection](subscription.md)
* [How to setup the database](store.md)
2 changes: 1 addition & 1 deletion docs/pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A lightweight but also all-inclusive event sourcing library with a focus on deve
* Automatic [snapshot](snapshots.md)-system to boost your performance
* [Split](split_stream.md) big aggregates into multiple streams
* Build-in [pipeline](pipeline.md) to export, import and migrate event streams
* Versioned and managed lifecycle of [projections](projection.md)
* Versioned and managed lifecycle of [subscriptions](subscription.md) like projections and processors
* Smooth [upcasting](upcasting.md) of old events
* Simple setup with [scheme management](store.md) and [doctrine migration](migration.md)
* Built in [cli commands](cli.md) with [symfony](https://symfony.com/)
Expand Down
38 changes: 0 additions & 38 deletions docs/pages/processor.md

This file was deleted.

Loading

0 comments on commit 23fc743

Please sign in to comment.