Skip to content

Commit e30abda

Browse files
committed
Add callEntity/signalEntity overloads for options parameters
1 parent bb41acf commit e30abda

2 files changed

Lines changed: 99 additions & 0 deletions

File tree

client/src/main/java/com/microsoft/durabletask/TaskOrchestrationContext.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,19 @@ default void signalEntity(@Nonnull EntityInstanceId entityId, @Nonnull String op
629629
this.signalEntity(entityId, operationName, input, null);
630630
}
631631

632+
/**
633+
* Sends a fire-and-forget signal to a durable entity with the specified options but no input.
634+
* <p>
635+
* This is useful for scheduling a signal for future delivery without passing any input data.
636+
*
637+
* @param entityId the unique identifier of the target entity
638+
* @param operationName the name of the operation to invoke on the entity
639+
* @param options signal options such as scheduled delivery time
640+
*/
641+
default void signalEntity(@Nonnull EntityInstanceId entityId, @Nonnull String operationName, @Nonnull SignalEntityOptions options) {
642+
this.signalEntity(entityId, operationName, null, options);
643+
}
644+
632645
/**
633646
* Sends a fire-and-forget signal to a durable entity with the specified input and options.
634647
* <p>
@@ -697,6 +710,32 @@ default <V> Task<V> callEntity(@Nonnull EntityInstanceId entityId, @Nonnull Stri
697710
return this.callEntity(entityId, operationName, null, returnType);
698711
}
699712

713+
/**
714+
* Calls an operation on a durable entity with options and waits for the result (no input).
715+
*
716+
* @param entityId the unique identifier of the target entity
717+
* @param operationName the name of the operation to invoke on the entity
718+
* @param returnType the expected class type of the entity operation output
719+
* @param options call options such as timeout, or {@code null}
720+
* @param <V> the expected type of the entity operation output
721+
* @return a {@link Task} that completes when the entity operation completes
722+
*/
723+
default <V> Task<V> callEntity(@Nonnull EntityInstanceId entityId, @Nonnull String operationName, @Nonnull Class<V> returnType, @Nullable CallEntityOptions options) {
724+
return this.callEntity(entityId, operationName, null, returnType, options);
725+
}
726+
727+
/**
728+
* Calls an operation on a durable entity with options and waits for it to complete (no input, no return value).
729+
*
730+
* @param entityId the unique identifier of the target entity
731+
* @param operationName the name of the operation to invoke on the entity
732+
* @param options call options such as timeout, or {@code null}
733+
* @return a {@link Task} that completes when the entity operation completes
734+
*/
735+
default Task<Void> callEntity(@Nonnull EntityInstanceId entityId, @Nonnull String operationName, @Nullable CallEntityOptions options) {
736+
return this.callEntity(entityId, operationName, null, Void.class, options);
737+
}
738+
700739
/**
701740
* Acquires one or more entity locks for the duration of a critical section.
702741
* <p>

client/src/main/java/com/microsoft/durabletask/TaskOrchestrationEntityFeature.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,52 @@ public <TResult> Task<TResult> callEntity(
6262
return this.callEntity(entityId, operationName, null, returnType, null);
6363
}
6464

65+
/**
66+
* Calls an operation on an entity and waits for it to complete (no input, no return value).
67+
*
68+
* @param entityId the target entity
69+
* @param operationName the name of the operation
70+
* @return a task that completes when the operation completes
71+
*/
72+
public Task<Void> callEntity(
73+
@Nonnull EntityInstanceId entityId,
74+
@Nonnull String operationName) {
75+
return this.callEntity(entityId, operationName, null, Void.class, null);
76+
}
77+
78+
/**
79+
* Calls an operation on an entity with options and waits for the result (no input).
80+
*
81+
* @param entityId the target entity
82+
* @param operationName the name of the operation
83+
* @param returnType the expected return type
84+
* @param options the call options, or {@code null}
85+
* @param <TResult> the result type
86+
* @return a task that completes with the operation result
87+
*/
88+
public <TResult> Task<TResult> callEntity(
89+
@Nonnull EntityInstanceId entityId,
90+
@Nonnull String operationName,
91+
@Nonnull Class<TResult> returnType,
92+
@Nullable CallEntityOptions options) {
93+
return this.callEntity(entityId, operationName, null, returnType, options);
94+
}
95+
96+
/**
97+
* Calls an operation on an entity with options and waits for it to complete (no input, no return value).
98+
*
99+
* @param entityId the target entity
100+
* @param operationName the name of the operation
101+
* @param options the call options, or {@code null}
102+
* @return a task that completes when the operation completes
103+
*/
104+
public Task<Void> callEntity(
105+
@Nonnull EntityInstanceId entityId,
106+
@Nonnull String operationName,
107+
@Nullable CallEntityOptions options) {
108+
return this.callEntity(entityId, operationName, null, Void.class, options);
109+
}
110+
65111
/**
66112
* Signals an entity operation without waiting for completion.
67113
*
@@ -100,6 +146,20 @@ public void signalEntity(
100146
this.signalEntity(entityId, operationName, input, null);
101147
}
102148

149+
/**
150+
* Signals an entity operation with options but no input.
151+
*
152+
* @param entityId the target entity
153+
* @param operationName the operation name
154+
* @param options signal options such as scheduled delivery time
155+
*/
156+
public void signalEntity(
157+
@Nonnull EntityInstanceId entityId,
158+
@Nonnull String operationName,
159+
@Nonnull SignalEntityOptions options) {
160+
this.signalEntity(entityId, operationName, null, options);
161+
}
162+
103163
/**
104164
* Acquires one or more entity locks.
105165
*

0 commit comments

Comments
 (0)