diff --git a/src/DurableTask.Core/Entities/ClientEntityHelpers.cs b/src/DurableTask.Core/Entities/ClientEntityHelpers.cs index 155eb1eca..cc1482fee 100644 --- a/src/DurableTask.Core/Entities/ClientEntityHelpers.cs +++ b/src/DurableTask.Core/Entities/ClientEntityHelpers.cs @@ -25,6 +25,20 @@ namespace DurableTask.Core.Entities /// public static class ClientEntityHelpers { + /// + /// Create an event to represent an entity signal. + /// + /// The target instance. + /// A unique identifier for the request. + /// The name of the operation. + /// The serialized input for the operation. + /// The time to schedule this signal, or null if not a scheduled signal + /// The event to send. + public static EntityMessageEvent EmitOperationSignal(OrchestrationInstance targetInstance, Guid requestId, string operationName, string? input, (DateTime Original, DateTime Capped)? scheduledTimeUtc) + { + return EmitOperationSignal(targetInstance, requestId, operationName, input, scheduledTimeUtc, parentTraceContext: null, requestTime: null); + } + /// /// Create an event to represent an entity signal. /// @@ -37,7 +51,7 @@ public static class ClientEntityHelpers /// The time at which the request was made. /// Whether to create a trace for this signal operation. /// The event to send. - public static EntityMessageEvent EmitOperationSignal(OrchestrationInstance targetInstance, Guid requestId, string operationName, string? input, (DateTime Original, DateTime Capped)? scheduledTimeUtc, DistributedTraceContext? parentTraceContext = null, DateTimeOffset? requestTime = null, bool createTrace = false) + public static EntityMessageEvent EmitOperationSignal(OrchestrationInstance targetInstance, Guid requestId, string operationName, string? input, (DateTime Original, DateTime Capped)? scheduledTimeUtc, DistributedTraceContext? parentTraceContext, DateTimeOffset? requestTime, bool createTrace = false) { var request = new RequestMessage() { diff --git a/src/DurableTask.Core/Entities/OrchestrationEntityContext.cs b/src/DurableTask.Core/Entities/OrchestrationEntityContext.cs index 8a84df162..ad2f7c9f3 100644 --- a/src/DurableTask.Core/Entities/OrchestrationEntityContext.cs +++ b/src/DurableTask.Core/Entities/OrchestrationEntityContext.cs @@ -219,6 +219,27 @@ public IEnumerable EmitLockReleaseMessages() } } + /// + /// Creates a request message to be sent to an entity. + /// + /// The target entity. + /// The name of the operation. + /// If true, this is a signal, otherwise it is a call. + /// A unique identifier for this request. + /// A time for which to schedule the delivery, or null if this is not a scheduled message + /// The operation input + /// The event to send. + public EntityMessageEvent EmitRequestMessage( + OrchestrationInstance target, + string operationName, + bool oneWay, + Guid operationId, + (DateTime Original, DateTime Capped)? scheduledTimeUtc, + string? input) + { + return EmitRequestMessage(target, operationName, oneWay, operationId, scheduledTimeUtc, input, requestTime: null); + } + /// /// Creates a request message to be sent to an entity. /// @@ -238,7 +259,7 @@ public EntityMessageEvent EmitRequestMessage( Guid operationId, (DateTime Original, DateTime Capped)? scheduledTimeUtc, string? input, - DateTimeOffset? requestTime = null, + DateTimeOffset? requestTime, bool createTrace = false) { this.CheckEntitySupport();