Skip to content

Commit

Permalink
Updated inbox section (docs)
Browse files Browse the repository at this point in the history
  • Loading branch information
adimiko committed Jun 9, 2024
1 parent ffc9897 commit 38833ef
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions documentation/docs/inbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,51 @@ builder.Services.AddTransactionalBox(x =>
settings => settings.ServiceId = "ServiceName");
```

### Inbox Message
```csharp
public class CreateCustomerCommandMessage : InboxMessage
{
public Guid Id { get; init; }

public string FirstName { get; init; }

public string LastName { get; init; }

public int Age { get; init; }
}
```

### Inbox Definition
:::info
You do not need to define a inbox definition for each message.
Listens by default for incoming messages to the current service (does not listen on events).
If you want to listen for events, you need to define the `PublishedBy` property.
:::

```csharp
public class CreatedCustomerEventMessageDefinition : InboxDefinition<CreatedCustomerEventMessage>
{
public CreatedCustomerEventMessageDefinition()
{
PublishedBy = "Customers";
}
}
```

### Handling message in inbox handler

```csharp
public class CreatedCustomerEventMessageHandler : IInboxHandler<CreatedCustomerEventMessage>
{
...

public async Task Handle(CreatedCustomerEventMessage message, IExecutionContext executionContext)
{
// Your logic
}
}
```

## Storage

<table>
Expand Down

0 comments on commit 38833ef

Please sign in to comment.