From 387ef056511e74ee43ce043d3fef5d38e629f83e Mon Sep 17 00:00:00 2001 From: BEagle1984 Date: Sun, 29 Aug 2021 17:31:15 +0200 Subject: [PATCH] docs: improve comments in serialization doc --- docs/concepts/broker/serialization.md | 35 ++++++++++++++++++++------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/docs/concepts/broker/serialization.md b/docs/concepts/broker/serialization.md index 67482529f..d5d0c1d9d 100644 --- a/docs/concepts/broker/serialization.md +++ b/docs/concepts/broker/serialization.md @@ -40,22 +40,28 @@ public class MyEndpointsConfigurator : IEndpointsConfigurator .ProduceTo("inventory-events") .SerializeAsJson(serializer => serializer .UseFixedType())) - // The following configurations are equivalent, the second - // one being more implicit - .AddInbound(endpoint => endpoint + + // Specifying the message type will automatically + // switch to the JsonMessageSerializer + // and deserialize the specified type without + // needing the type header + .AddInbound(endpoint => endpoint .ConsumeFrom("order-events") .Configure(config => { config.GroupId = "my-consumer"; - }) - .DeserializeJson(serializer => serializer - .UseFixedType())) - .AddInbound(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()))); } ``` # [Legacy](#tab/json-fixed-type-legacy) @@ -111,7 +117,18 @@ public class MyEndpointsConfigurator : IEndpointsConfigurator { config.GroupId = "my-consumer"; }) - .DeserializeJsonUsingNewtonsoft())); + .DeserializeJsonUsingNewtonsoft()) + + // Specifying the message type will automatically + // switch to the NewtonsoftJsonMessageSerializer + .AddInbound(endpoint => endpoint + .ConsumeFrom("delivery-notification-events") + .Configure(config => + { + config.GroupId = "my-consumer"; + }) + .DeserializeJsonUsingNewtonsoft()) + ); } ``` # [Legacy](#tab/newtonsoft-legacy)