Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk-workflows/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<dependency>
<groupId>com.microsoft</groupId>
<artifactId>durabletask-client</artifactId>
<version>1.1.1</version>
<version>1.5.0</version>
Comment thread
artursouza marked this conversation as resolved.
</dependency>
<!--
manually declare durabletask-client's jackson dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.time.Duration;
import java.time.Instant;
import java.util.List;
import java.util.UUID;

public class DaprWorkflowContextImpl implements WorkflowContext {
private final TaskOrchestrationContext innerContext;
Expand Down Expand Up @@ -204,4 +205,12 @@ public void continueAsNew(Object input) {
public void continueAsNew(Object input, boolean preserveUnprocessedEvents) {
this.innerContext.continueAsNew(input, preserveUnprocessedEvents);
}

/**
* {@inheritDoc}
*/
@Override
public UUID newUuid() {
return this.innerContext.newUUID();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;

/**
* Context object used by workflow implementations to perform actions such as scheduling activities,
Expand Down Expand Up @@ -514,4 +515,19 @@ default void continueAsNew(Object input) {
* history, otherwise {@code false}
*/
void continueAsNew(Object input, boolean preserveUnprocessedEvents);

/**
* Create a new UUID that is safe for replay within a workflow.
*
* <p>
* The default implementation of this method creates a name-based UUID
* using the algorithm from RFC 4122 §4.3. The name input used to generate
* this value is a combination of the workflow instance ID and an
* internally managed sequence number.
*</p>
* @return a deterministic UUID
*/
default UUID newUuid() {
throw new RuntimeException("No implementation found.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,10 @@ public void callSubWorkflow() {
context.callSubWorkflow(expectedName, expectedInput, String.class);
verify(mockInnerContext, times(1)).callSubOrchestrator(expectedName, expectedInput, null, null, String.class);
}

@Test
public void newUuidTest() {
context.newUuid();
verify(mockInnerContext, times(1)).newUUID();
}
}