> 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/concepts/observers/broker-observer.md).

# BrokerObserver

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

```csharp
var monitor = BrokerObserver.Using(aBrokerInstance)
    .WaitingFor<MySampleMessage>();
```

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

```csharp
var monitor = BrokerObserver.Using(aBrokerInstance)
    .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.
