> For the complete documentation index, see [llms.txt](https://docs.radicalframework.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.radicalframework.com/release-1/concepts/index-1/broker-observer.md).

# BrokerObserver

As for the [PropertyObserver](/release-1/concepts/index-1/property-observer.md) or the [MementoObserver](/release-1/concepts/index-1/memento-observer.md) the BrokerObserver is an easy shortcut to react to message arrivals when using [the message broker](https://github.com/RadicalFx/documentation/tree/3311fbb6d65f98ece74ce84f7fde9dec2a25a7ee/messaging/message-broker.md).

```csharp
var broker = //instance of a IMessageBroker implementation.
var monitor = BrokerObserver.Using( broker )
    .WaitingFor<MySampleMessage>();
```

We can use a monitor to trigger, for example, the `CanExecuteChanged` event of a `ICommand` interface implementation:

```csharp
var broker = //instance of a IMessageBroker implementation.
var monitor = BrokerObserver.Using( broker )
    .WaitingFor<MySampleMessage>();

DelegateCommand.Create()
    .OnCanExecute( state =>
    {
        //evaluate if the command can be executed.
        return true;
    } )
    .OnExecute( state =>
    {
        //execute the command
    } )
    .AddMonitor( monitor );
```

What the above code does is to trigger the `CanExecuteChanged` logic each time a message of type `MySampleMessage` is delivered via the monitored message broker.
