# IInbox

Package: [Microsoft.Orleans.Durable](/orleans/docs/api/csharp/microsoft.orleans.durable/) 10.0.0-alpha.1

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable/Messaging/IInbox.cs#L21)

```csharp
public interface IInbox
```

Registers handlers for the messages delivered to a grain's inbox.

## Remarks

Each message is dispatched to the first registered handler which can handle it. Handlers can be registered at any time. [InboxExtensions](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.inboxextensions/) registers typed subject handlers.

A grain receives messages by resolving its inbox during construction or activation setup, typically by constructor injection, so the inbox recovers with the grain's journal.

A handler decodes the body, performs asynchronous I/O, validates local results, and checks cancellation before the first shared business or journaled mutation. From that mutation until it returns, it executes synchronously: it applies safe-to-commit business changes, stages outgoing messages through [IOutbox](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.ioutbox/), and calls [IInboxHandlerContext](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.iinboxhandlercontext/) or [IInboxHandlerContext](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.iinboxhandlercontext/). The runtime persists the outcome with those changes. Failures before a terminal operation follow the inbox retry and dead-letter policy.

## Methods

- [Register(IInboxHandler)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.iinbox/methods/register-orleans-durable-messaging-iinboxhandler-c958d797/)
- [Register(IInboxMessageSink)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.iinbox/methods/register-orleans-durable-messaging-iinboxmessagesink-da65af52/)
- [RegisterWakeup(Func&lt;TimeSpan?&gt;)](/orleans/docs/api/csharp/microsoft.orleans.durable/orleans.durable.messaging.iinbox/methods/registerwakeup-system-func-system-timespan-nullable-4ff1db13/)
