diff --git a/src/Dapr.Workflow/DaprWorkflowClientBuilderFactory.cs b/src/Dapr.Workflow/DaprWorkflowClientBuilderFactory.cs
index 7a854cf05..8e284baf3 100644
--- a/src/Dapr.Workflow/DaprWorkflowClientBuilderFactory.cs
+++ b/src/Dapr.Workflow/DaprWorkflowClientBuilderFactory.cs
@@ -41,7 +41,7 @@ public DaprWorkflowClientBuilderFactory(IConfiguration configuration, IHttpClien
_httpClientFactory = httpClientFactory;
_services = services;
}
-
+
///
/// Responsible for building the client itself.
///
@@ -50,17 +50,25 @@ public void CreateClientBuilder(Action configure)
{
_services.AddDurableTaskClient(builder =>
{
+ WorkflowRuntimeOptions options = new();
+ configure?.Invoke(options);
+
var apiToken = DaprDefaults.GetDefaultDaprApiToken(_configuration);
var grpcEndpoint = DaprDefaults.GetDefaultGrpcEndpoint(_configuration);
-
+
var httpClient = _httpClientFactory.CreateClient();
if (!string.IsNullOrWhiteSpace(apiToken))
{
- httpClient.DefaultRequestHeaders.Add( "Dapr-Api-Token", apiToken);
+ httpClient.DefaultRequestHeaders.Add("Dapr-Api-Token", apiToken);
}
- builder.UseGrpc(GrpcChannel.ForAddress(grpcEndpoint, new GrpcChannelOptions { HttpClient = httpClient }));
+ var channelOptions = options.GrpcChannelOptions ?? new GrpcChannelOptions
+ {
+ HttpClient = httpClient
+ };
+
+ builder.UseGrpc(GrpcChannel.ForAddress(grpcEndpoint, channelOptions));
builder.RegisterDirectly();
});
@@ -81,8 +89,12 @@ public void CreateClientBuilder(Action configure)
httpClient.DefaultRequestHeaders.Add("Dapr-Api-Token", apiToken);
}
- builder.UseGrpc(
- GrpcChannel.ForAddress(grpcEndpoint, new GrpcChannelOptions { HttpClient = httpClient }));
+ var channelOptions = options.GrpcChannelOptions ?? new GrpcChannelOptions
+ {
+ HttpClient = httpClient
+ };
+
+ builder.UseGrpc(GrpcChannel.ForAddress(grpcEndpoint, channelOptions));
}
else
{
diff --git a/src/Dapr.Workflow/WorkflowRuntimeOptions.cs b/src/Dapr.Workflow/WorkflowRuntimeOptions.cs
index adc925777..9f0081783 100644
--- a/src/Dapr.Workflow/WorkflowRuntimeOptions.cs
+++ b/src/Dapr.Workflow/WorkflowRuntimeOptions.cs
@@ -11,6 +11,8 @@
// limitations under the License.
// ------------------------------------------------------------------------
+using Grpc.Net.Client;
+
namespace Dapr.Workflow
{
using System;
@@ -29,6 +31,11 @@ public sealed class WorkflowRuntimeOptions
///
readonly Dictionary> factories = new();
+ ///
+ /// Override GrpcChannelOptions.
+ ///
+ internal GrpcChannelOptions? GrpcChannelOptions { get; private set; }
+
///
/// Initializes a new instance of the class.
///
@@ -117,6 +124,15 @@ public void RegisterActivity() where TActivity : class, IWorkflowActi
WorkflowLoggingService.LogActivityName(name);
});
}
+
+ ///
+ /// Uses the provided for creating the .
+ ///
+ /// The to use for creating the .
+ public void UseGrpcChannelOptions(GrpcChannelOptions grpcChannelOptions)
+ {
+ this.GrpcChannelOptions = grpcChannelOptions;
+ }
///
/// Method to add workflows and activities to the registry.
diff --git a/test/Dapr.E2E.Test.App/Startup.cs b/test/Dapr.E2E.Test.App/Startup.cs
index bfca60f91..7cd7b496a 100644
--- a/test/Dapr.E2E.Test.App/Startup.cs
+++ b/test/Dapr.E2E.Test.App/Startup.cs
@@ -33,6 +33,7 @@ namespace Dapr.E2E.Test
using System;
using Microsoft.Extensions.Logging;
using Serilog;
+ using Grpc.Net.Client;
///
/// Startup class.
@@ -98,6 +99,25 @@ public void ConfigureServices(IServiceCollection services)
return Task.FromResult($"We are shipping {input} to the customer using our hoard of drones!");
});
});
+ services.AddDaprWorkflow(options =>
+ {
+ // Example of registering a "StartOrder" workflow function
+ options.RegisterWorkflow("StartLargeOrder", implementation: async (context, input) =>
+ {
+ var itemToPurchase = input;
+ itemToPurchase = await context.WaitForExternalEventAsync("FinishLargeOrder");
+ return itemToPurchase;
+ });
+ options.RegisterActivity("FinishLargeOrder", implementation: (context, input) =>
+ {
+ return Task.FromResult($"We are finishing, it's huge!");
+ });
+ options.UseGrpcChannelOptions(new GrpcChannelOptions
+ {
+ MaxReceiveMessageSize = 32 * 1024 * 1024,
+ MaxSendMessageSize = 32 * 1024 * 1024
+ });
+ });
services.AddActors(options =>
{
options.UseJsonSerialization = JsonSerializationEnabled;
diff --git a/test/Dapr.E2E.Test/DaprTestApp.cs b/test/Dapr.E2E.Test/DaprTestApp.cs
index 83f9948ac..152aeee98 100644
--- a/test/Dapr.E2E.Test/DaprTestApp.cs
+++ b/test/Dapr.E2E.Test/DaprTestApp.cs
@@ -58,6 +58,7 @@ public DaprTestApp(ITestOutputHelper output, string appId)
"--components-path", componentsPath,
"--config", configPath,
"--log-level", "debug",
+ "--dapr-http-max-request-size", "32",
};