From fae47325b0c8d7dafcdec5d1248191b24b2adc23 Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Thu, 5 Nov 2020 11:24:57 -0800 Subject: [PATCH] Finalizing dapr fixes (#756) --- samples/dapr/orders/Controllers/OrdersController.cs | 4 ++-- samples/dapr/orders/orders.csproj | 2 +- samples/dapr/products/products.csproj | 2 +- samples/dapr/store/Shared/ProductDisplay.razor | 2 +- samples/dapr/store/Startup.cs | 10 +++++++--- samples/dapr/store/store.csproj | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/samples/dapr/orders/Controllers/OrdersController.cs b/samples/dapr/orders/Controllers/OrdersController.cs index 3a630111..d7f055e6 100644 --- a/samples/dapr/orders/Controllers/OrdersController.cs +++ b/samples/dapr/orders/Controllers/OrdersController.cs @@ -10,7 +10,7 @@ namespace orders.Controllers [ApiController] public class OrdersController : ControllerBase { - [Topic("orderplaced")] + [Topic("messagebus", "orderplaced")] [HttpPost("orderplaced")] public async Task PlaceOrder(Order order, [FromServices] DaprClient dapr, [FromServices] ILogger logger) { @@ -49,7 +49,7 @@ namespace orders.Controllers }; } - await dapr.PublishEventAsync("orderprocessed", confirmation); + await dapr.PublishEventAsync("messagebus", "orderprocessed", confirmation); logger.LogInformation("Sent confirmation for order {OrderId}", order.OrderId); diff --git a/samples/dapr/orders/orders.csproj b/samples/dapr/orders/orders.csproj index 3b072fc1..75a55ca7 100644 --- a/samples/dapr/orders/orders.csproj +++ b/samples/dapr/orders/orders.csproj @@ -5,7 +5,7 @@ - + diff --git a/samples/dapr/products/products.csproj b/samples/dapr/products/products.csproj index 3b072fc1..75a55ca7 100644 --- a/samples/dapr/products/products.csproj +++ b/samples/dapr/products/products.csproj @@ -5,7 +5,7 @@ - + diff --git a/samples/dapr/store/Shared/ProductDisplay.razor b/samples/dapr/store/Shared/ProductDisplay.razor index 316b19c2..be631c69 100644 --- a/samples/dapr/store/Shared/ProductDisplay.razor +++ b/samples/dapr/store/Shared/ProductDisplay.razor @@ -46,7 +46,7 @@ var task = Broker.GetOrderConfirmationAsync(orderId, cts.Token); - await Dapr.PublishEventAsync("orderplaced", new Order() + await Dapr.PublishEventAsync("messagebus", "orderplaced", new Order() { ProductId = Product.Id, OrderId = orderId, diff --git a/samples/dapr/store/Startup.cs b/samples/dapr/store/Startup.cs index 4d6459f0..17ad36d3 100644 --- a/samples/dapr/store/Startup.cs +++ b/samples/dapr/store/Startup.cs @@ -1,6 +1,7 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; +using System.Text; using System.Text.Json; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; @@ -63,9 +64,12 @@ namespace store var broker = endpoints.ServiceProvider.GetRequiredService(); endpoints.MapPost("/orderprocessed", async context => { - var confirmation = await JsonSerializer.DeserializeAsync(context.Request.Body); + var confirmation = await JsonSerializer.DeserializeAsync(context.Request.Body, new JsonSerializerOptions() + { + PropertyNameCaseInsensitive = true + }); broker.Complete(confirmation); - }).WithTopic("orderprocessed"); + }).WithTopic("messagebus", "orderprocessed"); }); } } diff --git a/samples/dapr/store/store.csproj b/samples/dapr/store/store.csproj index 271f1d9b..019088fd 100644 --- a/samples/dapr/store/store.csproj +++ b/samples/dapr/store/store.csproj @@ -5,7 +5,7 @@ - +