-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update readme with installation and configuration details
- Loading branch information
Showing
2 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,5 +1,49 @@ | ||
# 🫚 Gember MessageBus: Symfony Messenger | ||
# 🫚 Gember Message Bus: Symfony Messenger | ||
[](LICENSE) | ||
[](http://www.php.net) | ||
|
||
Gember MessageBus ([gember/event-sourcing](https://github.com/GemberPHP/event-sourcing)) implementation based on [symfony/messenger](https://github.com/symfony/messenger). | ||
[Gember Event Sourcing](https://github.com/GemberPHP/event-sourcing) Message Bus adapter based on [symfony/messenger](https://github.com/symfony/messenger). | ||
|
||
> All external dependencies in Gember Event Sourcing are organized into separate packages, | ||
> making it easy to swap out a vendor adapter for another. | ||
## Installation | ||
Install with Composer: | ||
```bash | ||
composer gember/message-bus-symfony | ||
``` | ||
|
||
## Configuration | ||
Bind this adapter to the `EventBus` interface in your service definitions. | ||
|
||
### Examples | ||
|
||
#### Vanilla PHP | ||
```php | ||
use Gember\MessageBusSymfony\SymfonyEventBus; | ||
use Symfony\Component\Messenger\Handler\HandlersLocator; | ||
use Symfony\Component\Messenger\MessageBus; | ||
use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware; | ||
|
||
$finder = new SymfonyEventBus( | ||
new MessageBus([ // An EventBus configuration of your choice | ||
new HandleMessageMiddleware(new HandlersLocator([ | ||
SomeEvent::class => [SomeEventSubscriber::class], | ||
// ... | ||
])), | ||
]), | ||
); | ||
``` | ||
|
||
#### Symfony | ||
It is recommended to use the [Symfony bundle](https://github.com/GemberPHP/event-sourcing-symfony-bundle) to configure Gember Event Sourcing. | ||
With this bundle, the adapter is automatically set as the default for Event Bus. | ||
|
||
If you're not using the bundle, you can bind it directly to the `EventBus` interface. | ||
|
||
```yaml | ||
Gember\EventSourcing\Util\Messaging\MessageBus\EventBus: | ||
class: Gember\MessageBusSymfony\SymfonyEventBus | ||
arguments: | ||
- '@event.bus' # or any other defined Symfony event bus | ||
``` |
This file contains 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