diff --git a/.github/workflows/validate_go_quickstarts.yaml b/.github/workflows/validate_go_quickstarts.yaml index 943621aa5..b79a0d052 100644 --- a/.github/workflows/validate_go_quickstarts.yaml +++ b/.github/workflows/validate_go_quickstarts.yaml @@ -35,23 +35,23 @@ jobs: env: DAPR_DEFAULT_IMAGE_REGISTRY: GHCR DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/master/install - GOVER: 1.18 + GOVER: 1.21 KUBERNETES_VERSION: v1.21.1 KIND_VERSION: v0.11.0 KIND_IMAGE_SHA: sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6 PODMAN_VERSION: 4.4.4 strategy: - matrix: + matrix: os: [ubuntu-latest] fail-fast: false steps: - - name: Check out code - uses: actions/checkout@v2 + - name: Check out code + uses: actions/checkout@v4 - name: Load environment variables uses: artursouza/export-env-action@v2 with: - envFile: './.github/env/global.env' - expand: 'true' + envFile: "./.github/env/global.env" + expand: "true" - name: Install podman - MacOS timeout-minutes: 15 if: matrix.os == 'macos-latest' @@ -76,7 +76,7 @@ jobs: sudo ln -s $(which podman) /usr/local/bin/docker sudo ln -s $(which podman-compose) /usr/local/bin/docker-compose - name: Set up Go ${{ env.GOVER }} - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: go-version: ${{ env.GOVER }} - name: Set up Dapr CLI - Mac/Linux @@ -84,7 +84,7 @@ jobs: run: wget -q ${{ env.DAPR_INSTALL_URL }}/install.sh -O - | /bin/bash -s ${{ env.DAPR_CLI_VERSION }} - name: Set up Dapr CLI - Windows if: matrix.os == 'windows-latest' - run: powershell -Command "\$$script=iwr -useb ${{ env.DAPR_INSTALL_URL }}/install.ps1; \$$block=[ScriptBlock]::Create(\$$script); invoke-command -ScriptBlock \$$block -ArgumentList ${{ env.DAPR_CLI_VERSION }}" + run: powershell -Command "\$$script=iwr -useb ${{ env.DAPR_INSTALL_URL }}/install.ps1; \$$block=[ScriptBlock]::Create(\$$script); invoke-command -ScriptBlock \$$block -ArgumentList ${{ env.DAPR_CLI_VERSION }}" - name: Install Dapr run: | export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} @@ -115,4 +115,5 @@ jobs: done - name: Linkcheck README.md run: | - make validate \ No newline at end of file + make validate + diff --git a/actors/csharp/sdk/service/SmokeDetectorActor.cs b/actors/csharp/sdk/service/SmokeDetectorActor.cs index 99374da48..c88b4abf8 100644 --- a/actors/csharp/sdk/service/SmokeDetectorActor.cs +++ b/actors/csharp/sdk/service/SmokeDetectorActor.cs @@ -36,7 +36,7 @@ protected override Task OnActivateAsync() /// protected override Task OnDeactivateAsync() { - // Provides Opportunity to perform optional cleanup. + // Provides opportunity to perform optional cleanup. Console.WriteLine($"Deactivating actor id: {Id}"); return Task.CompletedTask; } @@ -47,9 +47,12 @@ protected override Task OnDeactivateAsync() /// the user-defined MyData which will be stored into state store as "device_data" state public async Task SetDataAsync(SmartDeviceData data) { - // Data is saved to configured state store *implicitly* after each method execution by Actor's runtime. - // Data can also be saved *explicitly* by calling this.StateManager.SaveStateAsync(); - // State to be saved must be DataContract serializable. + // This set state action can happen along other state changing operations in each actor method and those changes will be maintained + // in a local cache to be committed as a single transaction to the backing store when the method has completed. As such, there is + // no need to (and in fact makes your code less transactional) call `this.StateManager.SaveStateAsync()` as it will be automatically + // invoked by the actor runtime following the conclusion of this method as part of the internal `OnPostActorMethodAsyncInternal` method. + + // Note also that all saved state must be DataContract serializable. await StateManager.SetStateAsync( deviceDataKey, data); diff --git a/pub_sub/go/http/README.md b/pub_sub/go/http/README.md index 4ecc48e5b..b56b7f2d8 100644 --- a/pub_sub/go/http/README.md +++ b/pub_sub/go/http/README.md @@ -27,8 +27,8 @@ expected_stderr_lines: output_match_mode: substring match_order: none background: true -sleep: 15 -timeout_seconds: 30 +sleep: 30 +timeout_seconds: 60 --> ```bash diff --git a/pub_sub/go/sdk/README.md b/pub_sub/go/sdk/README.md index 1ebfaf9ca..5e78c5c55 100644 --- a/pub_sub/go/sdk/README.md +++ b/pub_sub/go/sdk/README.md @@ -27,8 +27,8 @@ expected_stderr_lines: output_match_mode: substring match_order: none background: true -sleep: 15 -timeout_seconds: 30 +sleep: 30 +timeout_seconds: 60 --> ```bash diff --git a/secrets_management/go/http/README.md b/secrets_management/go/http/README.md index d86f0196a..862078fe8 100644 --- a/secrets_management/go/http/README.md +++ b/secrets_management/go/http/README.md @@ -32,4 +32,4 @@ dapr run --app-id order-processor --resources-path ../../../components/ -- go ru ```bash dapr stop --app-id order-processor -``` \ No newline at end of file +``` diff --git a/service_invocation/csharp/http/checkout/Program.cs b/service_invocation/csharp/http/checkout/Program.cs index 98206e140..76995f23f 100644 --- a/service_invocation/csharp/http/checkout/Program.cs +++ b/service_invocation/csharp/http/checkout/Program.cs @@ -1,21 +1,19 @@ using System.Text; using System.Text.Json; using System.Text.Json.Serialization; +using Dapr.Client; -var baseURL = (Environment.GetEnvironmentVariable("BASE_URL") ?? "http://localhost") + ":" + (Environment.GetEnvironmentVariable("DAPR_HTTP_PORT") ?? "3500"); - -var client = new HttpClient(); -client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); -// Adding app id as part of the header -client.DefaultRequestHeaders.Add("dapr-app-id", "order-processor"); +var client = DaprClient.CreateInvokeHttpClient(appId: "order-processor"); for (int i = 1; i <= 20; i++) { var order = new Order(i); - var orderJson = JsonSerializer.Serialize(order); - var content = new StringContent(orderJson, Encoding.UTF8, "application/json"); + + var cts = new CancellationTokenSource(); + Console.CancelKeyPress += (object? sender, ConsoleCancelEventArgs e) => cts.Cancel(); // Invoking a service - var response = await client.PostAsync($"{baseURL}/orders", content); + var response = await client.PostAsJsonAsync("/orders", order, cts.Token); + Console.WriteLine("Order passed: " + order); await Task.Delay(TimeSpan.FromSeconds(1)); diff --git a/service_invocation/csharp/http/checkout/checkout.csproj b/service_invocation/csharp/http/checkout/checkout.csproj index 42ba9218c..99336c79b 100644 --- a/service_invocation/csharp/http/checkout/checkout.csproj +++ b/service_invocation/csharp/http/checkout/checkout.csproj @@ -7,4 +7,9 @@ enable - + + + + + + \ No newline at end of file diff --git a/service_invocation/go/http/README.md b/service_invocation/go/http/README.md index 3ab01e0ef..c36459dc0 100644 --- a/service_invocation/go/http/README.md +++ b/service_invocation/go/http/README.md @@ -24,8 +24,8 @@ expected_stderr_lines: output_match_mode: substring match_order: none background: true -sleep: 15 -timeout_seconds: 30 +sleep: 30 +timeout_seconds: 60 --> ```bash diff --git a/workflows/csharp/sdk/order-processor/Program.cs b/workflows/csharp/sdk/order-processor/Program.cs index a79f04752..68711c1e0 100644 --- a/workflows/csharp/sdk/order-processor/Program.cs +++ b/workflows/csharp/sdk/order-processor/Program.cs @@ -33,9 +33,7 @@ using var daprClient = new DaprClientBuilder().Build(); -// NOTE: WorkflowEngineClient will be replaced with a richer version of DaprClient -// in a subsequent SDK release. This is a temporary workaround. -WorkflowEngineClient workflowClient = host.Services.GetRequiredService(); +DaprWorkflowClient workflowClient = host.Services.GetRequiredService(); // Generate a unique ID for the workflow string orderId = Guid.NewGuid().ToString()[..8]; @@ -51,28 +49,25 @@ // Start the workflow Console.WriteLine("Starting workflow {0} purchasing {1} {2}", orderId, ammountToPurchase, itemToPurchase); -await daprClient.StartWorkflowAsync( - workflowComponent: DaprWorkflowComponent, - workflowName: nameof(OrderProcessingWorkflow), - input: orderInfo, - instanceId: orderId); +await workflowClient.ScheduleNewWorkflowAsync( + name: nameof(OrderProcessingWorkflow), + instanceId: orderId, + input: orderInfo); // Wait for the workflow to start and confirm the input -GetWorkflowResponse state = await daprClient.WaitForWorkflowStartAsync( - instanceId: orderId, - workflowComponent: DaprWorkflowComponent); +WorkflowState state = await workflowClient.WaitForWorkflowStartAsync( + instanceId: orderId); -Console.WriteLine("Your workflow has started. Here is the status of the workflow: {0}", state.RuntimeStatus); +Console.WriteLine("Your workflow has started. Here is the status of the workflow: {0}", Enum.GetName(typeof(WorkflowRuntimeStatus), state.RuntimeStatus)); // Wait for the workflow to complete -state = await daprClient.WaitForWorkflowCompletionAsync( - instanceId: orderId, - workflowComponent: DaprWorkflowComponent); +state = await workflowClient.WaitForWorkflowCompletionAsync( + instanceId: orderId); -Console.WriteLine("Workflow Status: {0}", state.RuntimeStatus); +Console.WriteLine("Workflow Status: {0}", Enum.GetName(typeof(WorkflowRuntimeStatus), state.RuntimeStatus)); void RestockInventory(string itemToPurchase) { - daprClient.SaveStateAsync(StoreName, itemToPurchase, new OrderPayload(Name: itemToPurchase, TotalCost: 15000, Quantity: 100)); + daprClient.SaveStateAsync(StoreName, itemToPurchase, new OrderPayload(Name: itemToPurchase, TotalCost: 15000, Quantity: 100)); return; }