Skip to content

Commit

Permalink
updated doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Janos Szurovecz committed Nov 1, 2014
1 parent 5658178 commit 8593d9b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/predaddy/messagehandling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,13 @@ $messageCallback = MessageCallbackClosures::builder()
All `MessageBus` implementation catches all exceptions thrown by handlers, so the messages are being forwarded
to all handlers, even if some of them throw exception.

If you need to handle exceptions, you can implement `SubscriberExceptionHandler` interface and pass the object to the `SimpleMessageBus`'s constructor.
If you need to handle exceptions, you can implement `SubscriberExceptionHandler` interface and use builder to instantiate the bus:

```php
$bus = SimpleMessageBus::builder()
->withExceptionHandler($exceptionHandler)
->build();
```

### Handler prioritization

Expand Down Expand Up @@ -252,15 +258,15 @@ There is a default implementation of `MessageBus` interface called `SimpleMessag
#### CommandBus

`Message` objects must implement `Command` interface. The typehint in the handler methods must be exactly the same as the command object's type. If more than one
handler can the command passed to, `LogicException` will be thrown.
handler can the command passed to, `IllegalStateException` will be thrown.

#### DirectCommandBus

`DirectCommandBus` extends `CommandBus` and automatically registers a `DirectCommandForwarder` object as a handler which handles all unhandled commands. This bus should be used if business method parameters in the aggregates are mostly `Command` objects.

#### EventBus

Does not modify the behavior of `SimpleMessageBus`, it just clarifies its purpose.
Only `Event` objects will be passed to the appropriate handlers.

#### Mf4phpMessageBus

Expand Down

0 comments on commit 8593d9b

Please sign in to comment.