mirror of https://github.com/dapr/quickstarts.git
Merge branch 'master' of github.com:dapr/quickstarts into release-1.15
Signed-off-by: Paul Yuknewicz <paulyuk@microsoft.com>
This commit is contained in:
commit
988bde68f9
|
@ -13,7 +13,7 @@ Let's take a look at the Dapr [Actors building block](https://docs.dapr.io/devel
|
||||||
For this example, you will need:
|
For this example, you will need:
|
||||||
|
|
||||||
- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started).
|
- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started).
|
||||||
- [.NET 7 SDK](https://dotnet.microsoft.com/download).
|
- [.NET 8 SDK](https://dotnet.microsoft.com/download).
|
||||||
- Docker Desktop
|
- Docker Desktop
|
||||||
|
|
||||||
### Step 2: Set up the environment
|
### Step 2: Set up the environment
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapr.Actors" Version="1.14.*-*" />
|
<PackageReference Include="Dapr.Actors" Version="1.15.0-rc02" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapr.Actors" Version="1.14.*-*" />
|
<PackageReference Include="Dapr.Actors" Version="1.15.0-rc02" />
|
||||||
<PackageReference Include="Dapr.Actors.AspNetCore" Version="1.14.*-*" />
|
<PackageReference Include="Dapr.Actors.AspNetCore" Version="1.15.0-rc02" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapr.AspNetCore" Version="1.14.*-*" />
|
<PackageReference Include="Dapr.AspNetCore" Version="1.15.0-rc02" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
|
@ -31,6 +31,8 @@ builder.Services.Configure<RequestLocalizationOptions>(options =>
|
||||||
options.SupportedCultures = [invariantCulture];
|
options.SupportedCultures = [invariantCulture];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.Services.AddDaprClient();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
if (app.Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); }
|
if (app.Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); }
|
||||||
|
@ -38,13 +40,12 @@ if (app.Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); }
|
||||||
app.UseRequestLocalization();
|
app.UseRequestLocalization();
|
||||||
|
|
||||||
// Triggered by Dapr input binding
|
// Triggered by Dapr input binding
|
||||||
app.MapPost("/" + cronBindingName, async () =>
|
app.MapPost("/" + cronBindingName, async (DaprClient client) =>
|
||||||
{
|
{
|
||||||
Console.WriteLine("Processing batch..");
|
Console.WriteLine("Processing batch..");
|
||||||
|
|
||||||
string jsonFile = File.ReadAllText("../../../orders.json");
|
string jsonFile = File.ReadAllText("../../../orders.json");
|
||||||
var ordersArray = JsonSerializer.Deserialize<Orders>(jsonFile);
|
var ordersArray = JsonSerializer.Deserialize<Orders>(jsonFile);
|
||||||
using var client = new DaprClientBuilder().Build();
|
|
||||||
foreach (Order ord in ordersArray?.orders ?? new Order[] { })
|
foreach (Order ord in ordersArray?.orders ?? new Order[] { })
|
||||||
{
|
{
|
||||||
var sqlText = $"insert into orders (orderid, customer, price) values ({ord.OrderId}, '{ord.Customer}', {ord.Price});";
|
var sqlText = $"insert into orders (orderid, customer, price) values ({ord.OrderId}, '{ord.Customer}', {ord.Price});";
|
||||||
|
@ -65,5 +66,5 @@ app.MapPost("/" + cronBindingName, async () =>
|
||||||
|
|
||||||
await app.RunAsync();
|
await app.RunAsync();
|
||||||
|
|
||||||
public record Order([property: JsonPropertyName("orderid")] int OrderId, [property: JsonPropertyName("customer")] string Customer, [property: JsonPropertyName("price")] float Price);
|
public sealed record Order([property: JsonPropertyName("orderid")] int OrderId, [property: JsonPropertyName("customer")] string Customer, [property: JsonPropertyName("price")] float Price);
|
||||||
public record Orders([property: JsonPropertyName("orders")] Order[] orders);
|
public sealed record Orders([property: JsonPropertyName("orders")] Order[] orders);
|
|
@ -1,3 +1,4 @@
|
||||||
dapr>=1.14.0a,<1.15.0
|
dapr>=1.14.0a,<1.15.0
|
||||||
Flask
|
Flask
|
||||||
typing-extensions
|
typing-extensions
|
||||||
|
werkzeug>=3.0.3 # not directly required, pinned by Snyk to avoid a vulnerability
|
|
@ -60,7 +60,7 @@ expected_stdout_lines:
|
||||||
- '== APP == Encrypted the message, got 856 bytes'
|
- '== APP == Encrypted the message, got 856 bytes'
|
||||||
- '== APP == Decrypted the message, got 24 bytes'
|
- '== APP == Decrypted the message, got 24 bytes'
|
||||||
- '== APP == The secret is "passw0rd"'
|
- '== APP == The secret is "passw0rd"'
|
||||||
- '== APP == Wrote encrypted data to encrypted.out'
|
- '== APP == Wrote decrypted data to encrypted.out'
|
||||||
- '== APP == Wrote decrypted data to decrypted.out.jpg'
|
- '== APP == Wrote decrypted data to decrypted.out.jpg'
|
||||||
- "Exited App successfully"
|
- "Exited App successfully"
|
||||||
expected_stderr_lines:
|
expected_stderr_lines:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
Flask
|
Flask
|
||||||
dapr
|
dapr
|
||||||
cloudevents
|
cloudevents
|
||||||
|
werkzeug>=3.0.3 # not directly required, pinned by Snyk to avoid a vulnerability
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
Flask
|
Flask
|
||||||
dapr
|
dapr
|
||||||
typing-extensions
|
typing-extensions
|
||||||
|
werkzeug>=3.0.3 # not directly required, pinned by Snyk to avoid a vulnerability
|
|
@ -1 +1,2 @@
|
||||||
requests
|
requests
|
||||||
|
urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability
|
||||||
|
|
|
@ -2,7 +2,7 @@ Click==7.0
|
||||||
Flask==1.1.1
|
Flask==1.1.1
|
||||||
Flask-Cors==3.0.9
|
Flask-Cors==3.0.9
|
||||||
itsdangerous==1.1.0
|
itsdangerous==1.1.0
|
||||||
Jinja2==2.11.3
|
Jinja2==3.1.4
|
||||||
MarkupSafe==1.1.1
|
MarkupSafe==1.1.1
|
||||||
six==1.12.0
|
six==1.12.0
|
||||||
Werkzeug==0.15.6
|
Werkzeug==0.15.6
|
||||||
|
|
Loading…
Reference in New Issue