mirror of https://github.com/dapr/java-sdk.git
add support for custom status
Signed-off-by: salaboy <Salaboy@gmail.com>
This commit is contained in:
parent
04b19e1cf7
commit
13754b5879
|
|
@ -526,4 +526,12 @@ public interface WorkflowContext {
|
||||||
default UUID newUuid() {
|
default UUID newUuid() {
|
||||||
throw new RuntimeException("No implementation found.");
|
throw new RuntimeException("No implementation found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a custom status to a workflow execution.
|
||||||
|
*
|
||||||
|
* @param status to be set to the current execution
|
||||||
|
*/
|
||||||
|
void setCustomStatus(Object status);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -294,4 +294,13 @@ public class DefaultWorkflowContext implements WorkflowContext {
|
||||||
return workflowTaskRetryHandler.handle(workflowRetryContext);
|
return workflowTaskRetryHandler.handle(workflowRetryContext);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set custom status to a workflow execution.
|
||||||
|
*
|
||||||
|
* @param status to set to the execution
|
||||||
|
*/
|
||||||
|
public void setCustomStatus(Object status) {
|
||||||
|
innerContext.setCustomStatus(status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,11 @@ public class DefaultWorkflowContextTest {
|
||||||
@Override
|
@Override
|
||||||
public void continueAsNew(Object input, boolean preserveUnprocessedEvents) {
|
public void continueAsNew(Object input, boolean preserveUnprocessedEvents) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCustomStatus(Object status) {
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -403,6 +408,15 @@ public class DefaultWorkflowContextTest {
|
||||||
verify(mockInnerContext, times(1)).callSubOrchestrator(expectedName, expectedInput, null, null, String.class);
|
verify(mockInnerContext, times(1)).callSubOrchestrator(expectedName, expectedInput, null, null, String.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setCustomStatusWorkflow() {
|
||||||
|
String customStatus = "CustomStatus";
|
||||||
|
|
||||||
|
context.setCustomStatus(customStatus);
|
||||||
|
verify(mockInnerContext, times(1)).setCustomStatus(customStatus);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void newUuidTest() {
|
public void newUuidTest() {
|
||||||
context.newUuid();
|
context.newUuid();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue