|
9 | 9 | import com.microsoft.azure.functions.HttpStatus; |
10 | 10 | import com.microsoft.durabletask.DurableTaskClient; |
11 | 11 | import com.microsoft.durabletask.DurableTaskGrpcClientFactory; |
| 12 | +import com.microsoft.durabletask.DurableEntityClient; |
| 13 | +import com.microsoft.durabletask.EntityInstanceId; |
| 14 | +import com.microsoft.durabletask.EntityMetadata; |
| 15 | +import com.microsoft.durabletask.EntityQuery; |
| 16 | +import com.microsoft.durabletask.EntityQueryResult; |
| 17 | +import com.microsoft.durabletask.CleanEntityStorageRequest; |
| 18 | +import com.microsoft.durabletask.CleanEntityStorageResult; |
12 | 19 | import com.microsoft.durabletask.OrchestrationMetadata; |
13 | 20 | import com.microsoft.durabletask.OrchestrationRuntimeStatus; |
14 | 21 |
|
@@ -133,6 +140,79 @@ public HttpManagementPayload createHttpManagementPayload(HttpRequestMessage<?> r |
133 | 140 | return this.getClientResponseLinks(request, instanceId); |
134 | 141 | } |
135 | 142 |
|
| 143 | + /** |
| 144 | + * Gets the entity client for interacting with durable entities. |
| 145 | + * <p> |
| 146 | + * This mirrors the .NET SDK's {@code DurableTaskClient.Entities} property. |
| 147 | + * |
| 148 | + * @return the {@link DurableEntityClient} for this client |
| 149 | + */ |
| 150 | + public DurableEntityClient getEntities() { |
| 151 | + return getClient().getEntities(); |
| 152 | + } |
| 153 | + |
| 154 | + /** |
| 155 | + * Sends a fire-and-forget signal to a durable entity. |
| 156 | + * |
| 157 | + * @param entityId the target entity's instance ID |
| 158 | + * @param operationName the name of the operation to invoke on the entity |
| 159 | + * @param input the input to pass to the operation (may be {@code null}) |
| 160 | + */ |
| 161 | + public void signalEntity(EntityInstanceId entityId, String operationName, Object input) { |
| 162 | + getClient().getEntities().signalEntity(entityId, operationName, input); |
| 163 | + } |
| 164 | + |
| 165 | + /** |
| 166 | + * Sends a fire-and-forget signal to a durable entity with no input. |
| 167 | + * |
| 168 | + * @param entityId the target entity's instance ID |
| 169 | + * @param operationName the name of the operation to invoke on the entity |
| 170 | + */ |
| 171 | + public void signalEntity(EntityInstanceId entityId, String operationName) { |
| 172 | + getClient().getEntities().signalEntity(entityId, operationName); |
| 173 | + } |
| 174 | + |
| 175 | + /** |
| 176 | + * Gets the metadata for a durable entity, including optionally its serialized state. |
| 177 | + * |
| 178 | + * @param entityId the entity's instance ID |
| 179 | + * @param includeState whether to include the entity's serialized state in the result |
| 180 | + * @return the entity metadata, or {@code null} if the entity does not exist |
| 181 | + */ |
| 182 | + public EntityMetadata getEntityMetadata(EntityInstanceId entityId, boolean includeState) { |
| 183 | + return getClient().getEntities().getEntityMetadata(entityId, includeState); |
| 184 | + } |
| 185 | + |
| 186 | + /** |
| 187 | + * Gets the metadata for a durable entity without including its serialized state. |
| 188 | + * |
| 189 | + * @param entityId the entity's instance ID |
| 190 | + * @return the entity metadata, or {@code null} if the entity does not exist |
| 191 | + */ |
| 192 | + public EntityMetadata getEntityMetadata(EntityInstanceId entityId) { |
| 193 | + return getClient().getEntities().getEntityMetadata(entityId); |
| 194 | + } |
| 195 | + |
| 196 | + /** |
| 197 | + * Queries the durable store for entity instances matching the specified filter criteria. |
| 198 | + * |
| 199 | + * @param query the query filter criteria |
| 200 | + * @return the query result containing matching entities and an optional continuation token |
| 201 | + */ |
| 202 | + public EntityQueryResult queryEntities(EntityQuery query) { |
| 203 | + return getClient().getEntities().queryEntities(query); |
| 204 | + } |
| 205 | + |
| 206 | + /** |
| 207 | + * Cleans up entity storage by removing empty entities and/or releasing orphaned locks. |
| 208 | + * |
| 209 | + * @param request the clean storage request specifying what to clean |
| 210 | + * @return the result of the clean operation, including counts of removed entities and released locks |
| 211 | + */ |
| 212 | + public CleanEntityStorageResult cleanEntityStorage(CleanEntityStorageRequest request) { |
| 213 | + return getClient().getEntities().cleanEntityStorage(request); |
| 214 | + } |
| 215 | + |
136 | 216 | private HttpManagementPayload getClientResponseLinks(HttpRequestMessage<?> request, String instanceId) { |
137 | 217 | String instanceStatusURL = this.getInstanceStatusURL(request, instanceId); |
138 | 218 | return new HttpManagementPayload(instanceId, instanceStatusURL, this.requiredQueryStringParameters); |
|
0 commit comments