Skip to content

Commit

Permalink
docs: improve comments in serialization doc
Browse files Browse the repository at this point in the history
  • Loading branch information
BEagle1984 committed Aug 29, 2021
1 parent 4483fb2 commit 387ef05
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions docs/concepts/broker/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,28 @@ public class MyEndpointsConfigurator : IEndpointsConfigurator
.ProduceTo("inventory-events")
.SerializeAsJson(serializer => serializer
.UseFixedType<InventoryEvent>()))
// The following configurations are equivalent, the second
// one being more implicit
.AddInbound(endpoint => endpoint

// Specifying the message type will automatically
// switch to the JsonMessageSerializer<TMessage>
// and deserialize the specified type without
// needing the type header
.AddInbound<OrderEvent>(endpoint => endpoint
.ConsumeFrom("order-events")
.Configure(config =>
{
config.GroupId = "my-consumer";
})
.DeserializeJson(serializer => serializer
.UseFixedType<OrderEvent>()))
.AddInbound<OrderEvent>(endpoint => endpoint
}))

// The following configurations is equivalent to the
// previous one, but more verbose
.AddInbound(endpoint => endpoint
.ConsumeFrom("order-events")
.Configure(config =>
{
config.GroupId = "my-consumer";
})));
})
.DeserializeJson(serializer => serializer
.UseFixedType<OrderEvent>())));
}
```
# [Legacy](#tab/json-fixed-type-legacy)
Expand Down Expand Up @@ -111,7 +117,18 @@ public class MyEndpointsConfigurator : IEndpointsConfigurator
{
config.GroupId = "my-consumer";
})
.DeserializeJsonUsingNewtonsoft()));
.DeserializeJsonUsingNewtonsoft())

// Specifying the message type will automatically
// switch to the NewtonsoftJsonMessageSerializer<TMessage>
.AddInbound<DeliveryNotification>(endpoint => endpoint
.ConsumeFrom("delivery-notification-events")
.Configure(config =>
{
config.GroupId = "my-consumer";
})
.DeserializeJsonUsingNewtonsoft())
);
}
```
# [Legacy](#tab/newtonsoft-legacy)
Expand Down

0 comments on commit 387ef05

Please sign in to comment.