зеркало из https://github.com/dotnet/tye.git
Finalizing dapr fixes (#756)
This commit is contained in:
Родитель
77ebc0d055
Коммит
fae47325b0
|
@ -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);
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Загрузка…
Ссылка в новой задаче