-
Notifications
You must be signed in to change notification settings - Fork 14
Improve docs around worker #854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -838,13 +838,28 @@ In order for the subscription engine to be able to do its work, you have to asse | |
| ### Message Loader | ||
|
|
||
| The subscription engine needs a message loader to load the messages. | ||
| We provide two implementations by default. | ||
| We provide three implementations by default. | ||
| Which one has a better performance depends on the use case. | ||
|
|
||
| !!! tip | ||
|
|
||
| We recommend the `GapResolverStoreMessageLoader` as it handles gaps in the stream. | ||
| We recommend the recent `GapResolverStoreMessageLoader` as it handles gaps in the stream. | ||
|
|
||
| !!! note | ||
|
|
||
| If you followed the confiration in the [Getting Started](./getting_started.md#configuration) section, | ||
| the Message Loader implementation replaces the $eventStore in the DefaultSubscriptionEngine. | ||
|
|
||
| ```php | ||
| $messageLoader = // whatever implementation you choose | ||
| $engine = new DefaultSubscriptionEngine( | ||
| - $eventStore, | ||
| + $messageLoader, | ||
| $subscriptionStore, | ||
| $subscriberRepository, | ||
| ); | ||
| ``` | ||
|
Brammm marked this conversation as resolved.
Comment on lines
+848
to
+861
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. then this is also not needed |
||
|
|
||
| #### Store Message Loader | ||
|
|
||
| The store message loader loads all the messages from the event store. | ||
|
|
@@ -1169,6 +1184,12 @@ $catchupSubscriptionEngine = new CatchUpSubscriptionEngine($subscriptionEngine); | |
| !!! tip | ||
|
|
||
| You can use the `CatchUpSubscriptionEngine` in your tests to process the events immediately. | ||
|
|
||
| !!! Note | ||
|
|
||
| Learn more about the worker [here](./cli.md#subscription-commands). | ||
|
|
||
| ## Subscription Lifecycle | ||
|
|
||
| ### Throw on error Subscription Engine | ||
|
|
||
|
|
@@ -1222,7 +1243,10 @@ $eventBus = new RunSubscriptionEngineRepositoryManager( | |
| !!! tip | ||
|
|
||
| You can perfectly use it in development or testing. | ||
| Especially in combination with the `CatchUpSubscriptionEngine` and `ThrowOnErrorSubscriptionEngine` decorators. | ||
| Especially in combination with the `CatchUpSubscriptionEngine` and `ThrowOnErrorSubscriptionEngine` | ||
| decorators. | ||
| Do note that, if you use this, you still need to make sure subscriptions are set up and booted. | ||
| Otherwise, subscriptions will only be processed on subsequent requests. | ||
|
|
||
| ## Usage | ||
|
|
||
|
|
@@ -1240,7 +1264,9 @@ $criteria = new SubscriptionEngineCriteria( | |
| !!! note | ||
|
|
||
| An `OR` check is made for the respective criteria and all criteria are checked with an `AND`. | ||
|
|
||
|
|
||
| All of the following steps have equivalent commands in the [CLI](./cli.md). | ||
|
|
||
| ### Setup | ||
|
|
||
| New subscriptions need to be set up before they can be used. | ||
|
|
@@ -1359,6 +1385,16 @@ use Patchlevel\EventSourcing\Subscription\Engine\SubscriptionEngineCriteria; | |
| /** @var SubscriptionEngine $subscriptionEngine */ | ||
| $subscriptionEngine->refresh(new SubscriptionEngineCriteria()); | ||
| ``` | ||
|
|
||
| ## Basic workflow for the worker | ||
|
|
||
| Use `event-sourcing:subscription:boot --setup` to first run the setup of any new subscriptions | ||
| and immediately boot them. | ||
|
|
||
| The `event-sourcing:subscription:run` command will continue to run and process new events | ||
| until the process is killed. After adding a new subscriber and booting it, you should | ||
| restart the `run` command. | ||
|
|
||
| ## Learn more | ||
|
|
||
| * [How to use CLI commands](./cli.md) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you misunderstood. Let's just update the getting started to use the message loader instead of adding a warning here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you open the PR that maintainers can edit it, I can also do the adjustment :)