Skip to content

Commit ebb1c0c

Browse files
committed
Integrate missing features from 3.5.0 to 3.13.0:
* ReadonlyStore * StoreMigrationCommand * Store options * CommandBus * QueryBus * MessageLoader * Multiple RetryStrategies * Tag default ArgumentResolver for Subscribers * Enable cryptography options
1 parent 311ed27 commit ebb1c0c

23 files changed

+1428
-210
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"require": {
2121
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
2222
"illuminate/contracts": "^10.0 || ^11.0 || ^12.0",
23-
"patchlevel/event-sourcing": "^3.5"
23+
"patchlevel/event-sourcing": "^3.13.0"
2424
},
2525
"require-dev": {
2626
"ext-pdo_sqlite": "*",

composer.lock

Lines changed: 110 additions & 109 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/event-sourcing.php

Lines changed: 124 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use Patchlevel\EventSourcing\Repository\AggregateOutdated;
4+
35
return [
46
/*
57
|--------------------------------------------------------------------------
@@ -17,6 +19,7 @@
1719
'EVENT_SOURCING_DB_CONNECTION',
1820
env('DB_CONNECTION', 'sqlite')
1921
),
22+
'provide_dedicated_connection' => true,
2023
],
2124

2225
/*
@@ -27,7 +30,7 @@
2730
| Here you can configure the event store.
2831
| You can choose between different types of stores.
2932
| dbal_aggregate (default): Store events in a single table with the aggregate and aggregate id.
30-
| dbal_stream (experimental): Store events in a single table with a stream id.
33+
| dbal_stream (new default in 4.x): Store events in a single table with a stream id.
3134
| in_memory: Store events in memory.
3235
| custom: Use a custom store, you need to provide a service.
3336
|
@@ -37,7 +40,36 @@
3740
'service' => null,
3841
'options' => [
3942
'table_name' => 'eventstore',
40-
]
43+
],
44+
'readonly' => false,
45+
'migrate_to_new_store' => [
46+
'enabled' => false,
47+
],
48+
],
49+
50+
/*
51+
|--------------------------------------------------------------------------
52+
| Migrate Store
53+
|--------------------------------------------------------------------------
54+
|
55+
| Here you can configure the migration options for the event store.
56+
| If you enable this option you can use our migration services for a smooth migration.
57+
| You can specify which translators should be used for the migratiop process and also
58+
| to which store you want to migrate.
59+
|
60+
| You can choose between different types of stores:
61+
| dbal_aggregate (default): Store events in a single table with the aggregate and aggregate id.
62+
| dbal_stream (new default in 4.x): Store events in a single table with a stream id.
63+
| in_memory: Store events in memory.
64+
| custom: Use a custom store, you need to provide a service.
65+
|
66+
*/
67+
'migrate_to_new_store' => [
68+
'enabled' => false,
69+
'type' => '',
70+
'service' => null,
71+
'options' => [],
72+
'translators' => [],
4173
],
4274

4375
/*
@@ -69,11 +101,30 @@
69101
*/
70102
'subscription' => [
71103
'throw_on_error' => true,
72-
'catch_up' => true,
73-
'retry_strategy' => [
74-
'base_delay' => 5,
75-
'delay_factor' => 2,
76-
'max_attempts' => 5,
104+
'catch_up' => [
105+
'enabled' => true,
106+
'limit' => null,
107+
],
108+
'retry_strategies' => [
109+
'default' => [
110+
'type' => 'clock_based',
111+
'options' => [
112+
'base_delay' => 5,
113+
'delay_factor' => 2,
114+
'max_attempts' => 5,
115+
],
116+
],
117+
'no_retry' => [
118+
'type' => 'no_retry',
119+
],
120+
],
121+
'default_retry_strategy' => 'default',
122+
'store' => [
123+
'type' => 'dbal',
124+
'service' => null,
125+
'options' => [
126+
'table_name' => 'subscriptions',
127+
],
77128
],
78129
'run_after_aggregate_save' => [
79130
'enabled' => true,
@@ -89,6 +140,11 @@
89140
'ids' => null,
90141
'groups' => null,
91142
],
143+
'gap_detection' => [
144+
'enabled' => false,
145+
'retries_in_ms' => [0, 5, 50, 500],
146+
'detection_window' => 'PT5M',
147+
],
92148
],
93149

94150
/*
@@ -102,7 +158,67 @@
102158
*/
103159
'cryptography' => [
104160
'enabled' => true,
105-
'algorithm' => 'aes256'
161+
'algorithm' => 'aes256',
162+
'use_encrypted_field_name' => false,
163+
'fallback_to_field_name' => false,
164+
],
165+
166+
/*
167+
|--------------------------------------------------------------------------
168+
| CommandBus
169+
|--------------------------------------------------------------------------
170+
|
171+
| Here you can enable or disable the command bus.
172+
| You can also configure the command bus regarding the retries and the handlers.
173+
|
174+
*/
175+
'command_bus' => [
176+
'enabled' => true,
177+
'instant_retry' => [
178+
'max_retries' => 3,
179+
'exceptions' => [
180+
AggregateOutdated::class,
181+
],
182+
],
183+
],
184+
185+
/*
186+
|--------------------------------------------------------------------------
187+
| QueryBus
188+
|--------------------------------------------------------------------------
189+
|
190+
| Here you can enable or disable the query bus.
191+
|
192+
*/
193+
'query_bus' => [
194+
'enabled' => true,
195+
],
196+
197+
/*
198+
|--------------------------------------------------------------------------
199+
| EventBus
200+
|--------------------------------------------------------------------------
201+
|
202+
| Here you can enable or disable the event bus.
203+
| The subscription engine is highly recommended to use instead of the event bus.
204+
|
205+
*/
206+
'event_bus' => [
207+
'enabled' => false,
208+
],
209+
210+
/*
211+
|--------------------------------------------------------------------------
212+
| Clock
213+
|--------------------------------------------------------------------------
214+
|
215+
| Here you can enable or disable the freeze clock or set a custom clock.
216+
| This is useful for testing purposes.
217+
|
218+
*/
219+
'clock' => [
220+
'freeze' => null,
221+
'service' => null,
106222
],
107223

108224
/*

docs/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ nav:
9393
- Installation: installation.md
9494
- Getting Started: getting_started.md
9595
- Facades: facades.md
96+
- Configuration: configuration.md
9697
- Links:
9798
- Blog: https://patchlevel.de/blog
9899
- Library Documentation: https://event-sourcing.patchlevel.io/latest/

0 commit comments

Comments
 (0)