Skip to content

Commit 8a725d6

Browse files
authored
Merge pull request #862 from patchlevel/docs/improve-and-fix-4.0-drift
Docs review: fix outdated 4.0 examples and clean up links
2 parents 57ec737 + 3150270 commit 8a725d6

15 files changed

Lines changed: 92 additions & 70 deletions

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,14 @@ powered by the reliable Doctrine ecosystem and focused on developer experience.
1313
* Everything is included in the package for event sourcing
1414
* Based on [doctrine dbal](https://github.com/doctrine/dbal) and their ecosystem
1515
* Developer experience oriented and fully typed
16-
* Automatic [snapshot](https://patchlevel.github.io/event-sourcing-docs/latest/snapshots/)-system to boost your
17-
performance
18-
* [Split](https://patchlevel.github.io/event-sourcing-docs/latest/split_stream/) big aggregates into multiple streams
19-
* Versioned and managed lifecycle
20-
of [subscriptions](https://patchlevel.github.io/event-sourcing-docs/latest/subscription/) like projections and
21-
processors
22-
* Safe usage of [Personal Data](https://patchlevel.github.io/event-sourcing-docs/latest/personal_data/) with
23-
crypto-shredding
24-
* Smooth [upcasting](https://patchlevel.github.io/event-sourcing-docs/latest/upcasting/) of old events
25-
* Simple setup with [scheme management](https://patchlevel.github.io/event-sourcing-docs/latest/store/)
26-
and [doctrine migration](https://patchlevel.github.io/event-sourcing-docs/latest/store/)
27-
* Built in [cli commands](https://patchlevel.github.io/event-sourcing-docs/latest/cli/)
28-
with [symfony](https://symfony.com/)
16+
* Automatic [snapshot](https://patchlevel.dev/docs/event-sourcing/latest/snapshots)-system to boost your performance
17+
* [Split](https://patchlevel.dev/docs/event-sourcing/latest/split-stream) big aggregates into multiple streams
18+
* Versioned and managed lifecycle of [subscriptions](https://patchlevel.dev/docs/event-sourcing/latest/subscription) like projections and processors
19+
* Safe usage of [personal data](https://patchlevel.dev/docs/event-sourcing/latest/personal-data) with crypto-shredding
20+
* Smooth [upcasting](https://patchlevel.dev/docs/event-sourcing/latest/upcasting) of old events
21+
* Simple setup with [schema management](https://patchlevel.dev/docs/event-sourcing/latest/store) and [doctrine migration](https://patchlevel.dev/docs/event-sourcing/latest/store)
22+
* Built in [cli commands](https://patchlevel.dev/docs/event-sourcing/latest/cli) with [symfony](https://symfony.com/)
23+
* Decisions across streams with a [dynamic consistency boundary](https://patchlevel.dev/docs/event-sourcing/latest/dynamic-consistency-boundary)
2924
* and much more...
3025

3126
## Installation
@@ -36,14 +31,21 @@ composer require patchlevel/event-sourcing
3631

3732
## Documentation
3833

39-
* Latest [Docs](https://event-sourcing.patchlevel.io/latest/getting_started/)
40-
* Related [Blog](https://patchlevel.de/blog)
34+
* Latest [Docs](https://patchlevel.dev/docs/event-sourcing/latest)
35+
* Related [Blog](https://patchlevel.dev/blog)
4136

4237
## Integration
4338

4439
* [Symfony](https://github.com/patchlevel/event-sourcing-bundle)
4540
* [Psalm](https://github.com/patchlevel/event-sourcing-psalm-plugin)
4641

42+
## Contributing
43+
44+
We are open to contributions as long as they are in line with
45+
our [BC-Policy](https://patchlevel.dev/our-backward-compatibility-promise).
46+
47+
Also note that the `composer.lock` is always generated with the newest supported PHP version as this is the version our tools run in the CI.
48+
4749
## Supported databases
4850

4951
We officially only support the databases and versions listed in the table, as these are tested in the CI.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dynamic consistency boundary",
2020
"patchlevel"
2121
],
22-
"homepage": "https://event-sourcing.patchlevel.io",
22+
"homepage": "https://patchlevel.dev/docs/event-sourcing/latest",
2323
"authors": [
2424
{
2525
"name": "Daniel Badura",

docs/command-bus.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,3 +425,4 @@ $provider = new ChainHandlerProvider([
425425
* [How to use clock](clock.md)
426426
* [How to use aggregate id](identifier.md)
427427
* [How to use query bus](query-bus.md)
428+
* [How to decide across streams with a dynamic consistency boundary](dynamic-consistency-boundary.md)

docs/dynamic-consistency-boundary.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ final class GuestIsCheckedOut
8787
```
8888

8989
:::note
90-
You can find out more about events [here](events.md).
90+
You can find out more about [events](events.md).
9191
:::
9292

9393
## Define Commands
@@ -456,6 +456,6 @@ You can find this [Getting Started](./getting-started.md) section.
456456

457457
## Learn more
458458

459-
* [Events](./events.md)
460-
* [Command Bus](./command-bus.md)
461-
* [Store](./store.md)
459+
* [How to define events](events.md)
460+
* [How to dispatch commands](command-bus.md)
461+
* [How to store events](store.md)

docs/events.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You can also listen on events to react and perform different actions.
88
An event has a name and additional information called payload.
99
Such an event can be represented as any class.
1010
It is important that the payload can be serialized as JSON at the end.
11-
Later it will be explained how to ensure it for all values.
11+
How to ensure this for complex values is shown in the [normalizer](#normalizer) section below.
1212

1313
To register an event you have to set the `Event` attribute over the class,
1414
otherwise it will not be recognized as an event.
@@ -80,7 +80,7 @@ $serializer = DefaultEventSerializer::createFromPaths(['src/Domain']);
8080
```
8181
The serializer needs the path information where the event classes are located
8282
so that it can instantiate the correct classes.
83-
Internally, an EventRegistry is used, which will be described later.
83+
Internally, an EventRegistry is used, which is described in the [Event Registry](#event-registry) section below.
8484

8585
## Normalizer
8686

docs/getting-started.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ You can find out more about [processors](subscription.md).
265265
After we have defined everything, we still have to plug the whole thing together:
266266

267267
:::tip
268-
If you use symfony, you can use our [symfony bundle](https://event-sourcing-bundle.patchlevel.io/latest/installation/) to skip this step.
268+
If you use symfony, you can use our [symfony bundle](https://patchlevel.dev/docs/event-sourcing-bundle/latest) to skip this step.
269269
:::
270270

271271
```php
@@ -326,7 +326,7 @@ $hotelRepository = $repositoryManager->get(Hotel::class);
326326
```
327327

328328
:::note
329-
You can find out more about stores [here](store.md).
329+
You can find out more about the [store](store.md).
330330
:::
331331

332332
## Database setup
@@ -386,12 +386,12 @@ $hotel2 = $hotelRepository->load(Uuid::fromString('d0d0d0d0-d0d0-d0d0-d0d0-d0d0d
386386
$hotel2->checkIn('David');
387387
$hotelRepository->save($hotel2);
388388

389-
$hotels = $hotelProjection->getHotels();
389+
$hotels = $hotelProjector->getHotels();
390390
```
391391

392392
:::note
393393
You can also use other forms of IDs such as uuid version 6 or a custom format.
394-
You can find more about this [here](identifier.md).
394+
You can find more about [identifiers](identifier.md).
395395
:::
396396

397397
## Result
File renamed without changes.

docs/message.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@ the [repository](repository.md).
1919
You can add a header using `withHeader`:
2020

2121
```php
22-
use Patchlevel\EventSourcing\Aggregate\AggregateHeader;
2322
use Patchlevel\EventSourcing\Clock\SystemClock;
2423
use Patchlevel\EventSourcing\Message\Message;
24+
use Patchlevel\EventSourcing\Store\Header\PlayheadHeader;
25+
use Patchlevel\EventSourcing\Store\Header\RecordedOnHeader;
26+
use Patchlevel\EventSourcing\Store\Header\StreamNameHeader;
2527

2628
$clock = new SystemClock();
2729
$message = Message::create(new NameChanged('foo'))
28-
->withHeader(new AggregateHeader(
29-
aggregateName: 'profile',
30-
aggregateId: 'bca7576c-536f-4428-b694-7b1f00c714b7',
31-
playhead: 2,
32-
recordedOn: $clock->now(),
33-
));
30+
->withHeader(new StreamNameHeader('profile-bca7576c-536f-4428-b694-7b1f00c714b7'))
31+
->withHeader(new PlayheadHeader(2))
32+
->withHeader(new RecordedOnHeader($clock->now()));
3433
```
3534
:::note
3635
The message object is immutable. It creates a new instance with the new data.
@@ -39,19 +38,24 @@ The message object is immutable. It creates a new instance with the new data.
3938
You can also access the headers:
4039

4140
```php
42-
use Patchlevel\EventSourcing\Aggregate\AggregateHeader;
4341
use Patchlevel\EventSourcing\Message\Message;
42+
use Patchlevel\EventSourcing\Store\Header\PlayheadHeader;
4443

4544
/** @var Message $message */
46-
$message->header(AggregateHeader::class); // AggregateHeader object
47-
$message->hasHeader(AggregateHeader::class); // true
48-
$message->headers(); // [AggregateHeader object]
45+
$message->header(PlayheadHeader::class); // PlayheadHeader object
46+
$message->hasHeader(PlayheadHeader::class); // true
47+
$message->headers(); // [StreamNameHeader object, PlayheadHeader object, ...]
4948
```
5049
## Built-in headers
5150

5251
The message object has some built-in headers which are used internally.
5352

54-
* `AggregateHeader` - Contains the aggregate name, aggregate id, playhead and recorded on.
53+
* `StreamNameHeader` - The name of the stream the message belongs to, in the format `[aggregateName]-[aggregateId]`.
54+
* `PlayheadHeader` - The position of the message within its stream.
55+
* `RecordedOnHeader` - The date and time when the message was recorded.
56+
* `EventIdHeader` - The unique id of the event.
57+
* `IndexHeader` - The global position of the message in the store.
58+
* `TagsHeader` - The tags attached to the message (experimental).
5559
* `ArchivedHeader` - Flag if the message is archived.
5660
* `StreamStartHeader` - Flag if the message is the first message in a new stream.
5761

docs/project.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"navigation": [
33
{
44
"title": "Introduction",
5-
"file": "index.md"
5+
"file": "introduction.md"
66
},
77
{
88
"title": "Getting Started",
@@ -80,6 +80,10 @@
8080
"title": "Split Stream",
8181
"file": "split-stream.md"
8282
},
83+
{
84+
"title": "Dynamic Consistency Boundary",
85+
"file": "dynamic-consistency-boundary.md"
86+
},
8387
{
8488
"title": "Time / Clock",
8589
"file": "clock.md"

docs/repository.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ An `AggregateOutdated` exception is thrown if a conflict occurs.
176176
:::
177177

178178
:::tip
179-
If you use the Command Bus, you can use the [RetryOutdatedAggregateCommandBus](command-bus.md#retry-outdated-aggregate-command-bus)
180-
to retry the command when an `AggregateOutdated` exception occurs automatically.
179+
If you use the Command Bus, you can use the [instant retry](command-bus.md#instant-retry) decorator
180+
to retry the command automatically when an `AggregateOutdated` exception occurs.
181181
:::
182182

183183
### Load an aggregate

0 commit comments

Comments
 (0)