Browse Source

Finalizing dapr fixes (#756)

pull/738/head release/0.5
Justin Kotalik 6 years ago
committed by GitHub
parent
commit
fae47325b0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      samples/dapr/orders/Controllers/OrdersController.cs
  2. 2
      samples/dapr/orders/orders.csproj
  3. 2
      samples/dapr/products/products.csproj
  4. 2
      samples/dapr/store/Shared/ProductDisplay.razor
  5. 10
      samples/dapr/store/Startup.cs
  6. 2
      samples/dapr/store/store.csproj

4
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<OrdersController> 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);

2
samples/dapr/orders/orders.csproj

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapr.AspNetCore" Version="0.8.0-preview01" />
<PackageReference Include="Dapr.AspNetCore" Version="0.11.0-preview02" />
</ItemGroup>
</Project>

2
samples/dapr/products/products.csproj

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapr.AspNetCore" Version="0.8.0-preview01" />
<PackageReference Include="Dapr.AspNetCore" Version="0.11.0-preview02" />
</ItemGroup>
</Project>

2
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,

10
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<OrdersEventBroker>();
endpoints.MapPost("/orderprocessed", async context =>
{
var confirmation = await JsonSerializer.DeserializeAsync<OrderConfirmation>(context.Request.Body);
var confirmation = await JsonSerializer.DeserializeAsync<OrderConfirmation>(context.Request.Body, new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true
});
broker.Complete(confirmation);
}).WithTopic("orderprocessed");
}).WithTopic("messagebus", "orderprocessed");
});
}
}

2
samples/dapr/store/store.csproj

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapr.AspNetCore" Version="0.8.0-preview01" />
<PackageReference Include="Dapr.AspNetCore" Version="0.11.0-preview02" />
</ItemGroup>
</Project>

Loading…
Cancel
Save