# Standalone message handlers

We have analyzed why we need a [messaging system](https://github.com/RadicalFx/documentation/tree/3593d0c5b04875dd1fb6be74908fc5cea4ac1a8d/messaging/message-broker.md) and how to interact with it at runtime sending and receiving messages.

There are scenarios in which the code that receive the message has nothing to do with the UI so there is no reason to subscribe to that message in a `ViewModel`, in this cases we can use stand alone message handlers to have a class that will be instantiated and executed at runtime each time a new message, in which we are interested, is received:

```csharp
class MyMessageHandler : AbstractMessageHandler<MyMessage>
{
    public override void Handle(object sender, MyMessage message)
    {
        //handle my message here.
    }
}
```

When using [message broker and messages](https://github.com/RadicalFx/documentation/tree/3593d0c5b04875dd1fb6be74908fc5cea4ac1a8d/messaging/message-broker.md) in the context of a MVVM based application Radical [bootstrap conventions](https://github.com/RadicalFx/documentation/tree/3593d0c5b04875dd1fb6be74908fc5cea4ac1a8d/mvvm/bootstrap-conventions.md), at boot time, will take care of registering in the IoC container all standalone message handlers that match the convention. That, in this case, is when classes are defined in a namespace ending with `*.Messaging.Handlers`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.radicalframework.com/release-2/concepts/message-broker/abstract-message-handler.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
