Skip to content

Commit

Permalink
Updated outbox section (docs)
Browse files Browse the repository at this point in the history
  • Loading branch information
adimiko committed Jun 9, 2024
1 parent f454fd6 commit ffc9897
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions documentation/docs/outbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,26 @@ builder.Services.AddTransactionalBox(x =>
},
settings => settings.ServiceId = "ServiceName");
```
### Outbox Message

### Outbox Definition
```csharp
public class CreateCustomerCommandMessage : OutboxMessage
{
public Guid Id { get; init; }

public string FirstName { get; init; }

public string LastName { get; init; }

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

### Outbox Definition
:::info
You do not need to define a outbox definition for each message.
By default, the message will be published because receiver is not indicated.
:::

```csharp
internal class CreateCustomerCommandMessageDefinition : OutboxDefinition<CreateCustomerCommandMessage>
{
Expand All @@ -37,6 +49,21 @@ internal class CreateCustomerCommandMessageDefinition : OutboxDefinition<CreateC

```

### Adding a message to the outbox

```csharp

// Add in the same transaction the result of the business operation and message to outbox
await outbox.Add(message);

// Commit transaction
// After transaction is successfully commited, execute the following method
await outbox.TransactionCommited();

```

## Storage

<table>
Expand Down

0 comments on commit ffc9897

Please sign in to comment.