cadence-java-samples
cadence-java-samples copied to clipboard
A new example with the following workflow: 1. Start Workflow (asynchronous) 2. Wait 3. Signal-1 => Do Activity-1 4. Wait 5. Signal-2 => Do Activity-2 6. Query the workflow
chid workflow history: ``` cadence --do samples-domain wf show -w aeca58a9-9a2e-3d39-b368-3f96a44c1eff -pdt 1 2021-07-26T22:25:04-07:00 WorkflowExecutionStarted {WorkflowType:{Name:GreetingChild::composeGreeting}, ParentWorkflowDomain:samples-domain, ParentWorkflowExecution:{WorkflowId:c54223df-8d1e-4d76-94cd-777a3a414e24, RunId:c018f96b-c20b-42bf-a2c7-e3fa857d1428}, ParentInitiatedEventId:5, TaskList:{Name:HelloCancelChild}, Input:[["Hello","World"]], ExecutionStartToCloseTimeoutSeconds:30, TaskStartToCloseTimeoutSeconds:10, ContinuedFailureDetails:[], LastCompletionResult:[], OriginalExecutionRunId:8ae116fa-4a52-4160-a5b7-a8c2cd9963b3, FirstExecutionRunId:8ae116fa-4a52-4160-a5b7-a8c2cd9963b3, Attempt:0, FirstDecisionTaskBackoffSeconds:0}...
``` Stack Trace: com.uber.cadence.client.WorkflowFailureException: WorkflowType="GreetingWorkflow::getGreeting", WorkflowID="64c080b5-f8a6-4739-b2c5-28ec54413a3b", RunID="c5684578-9fc6-4ff5-9413-4bbd5905d6a0, WorkflowType="GreetingWorkflow::getGreeting", WorkflowExecution="WorkflowExecution(workflowId:64c080b5-f8a6-4739-b2c5-28ec54413a3b, runId:c5684578-9fc6-4ff5-9413-4bbd5905d6a0)" at com.uber.cadence.internal.sync.WorkflowStubImpl.mapToWorkflowFailureException(WorkflowStubImpl.java:391) at com.uber.cadence.internal.sync.WorkflowStubImpl.getResult(WorkflowStubImpl.java:319) at com.uber.cadence.internal.sync.WorkflowStubImpl.getResult(WorkflowStubImpl.java:287) at com.uber.cadence.internal.sync.WorkflowInvocationHandler$SyncWorkflowInvocationHandler.startWorkflow(WorkflowInvocationHandler.java:289) at com.uber.cadence.internal.sync.WorkflowInvocationHandler$SyncWorkflowInvocationHandler.invoke(WorkflowInvocationHandler.java:248) at com.uber.cadence.internal.sync.WorkflowInvocationHandler.invoke(WorkflowInvocationHandler.java:164) at com.sun.proxy.$Proxy2.getGreeting(Unknown Source) at com.uber.cadence.samples.hello.HelloContinueAsNewException.main(HelloContinueAsNewException.java:91) Caused by: java.lang.RuntimeException:...
result: ``` > Task :HelloCancellation.main() workflow cancelled. Cancellation exception thrown [composeGreeting, sayGoodbye] ``` History: ``` cadence --do samples-domain wf show -w ffe54d88-3d82-4583-b0e0-ec4ed3b29ae6 -pdt 1 2021-05-12T21:38:05-07:00 WorkflowExecutionStarted {WorkflowType:{Name:GreetingWorkflow::getGreeting}, TaskList:{Name:HelloCancellation}, Input:["World"], ExecutionStartToCloseTimeoutSeconds:2592000,...
result ``` workflow cancelled. Cancellation exception thrown [composeGreeting, sayGoodbye] ``` History ``` cadence --do samples-domain wf show -pdt -w 1494d5dc-3dda-473b-b093-70bd9b695487 1 2021-05-12T21:56:06-07:00 WorkflowExecutionStarted {WorkflowType:{Name:GreetingWorkflow::getGreeting}, TaskList:{Name:HelloCancellation}, Input:["World"], ExecutionStartToCloseTimeoutSeconds:2592000, TaskStartToCloseTimeoutSeconds:10, ContinuedFailureDetails:[], LastCompletionResult:[],...
``` 5:27:17 PM: Executing task 'HelloLocalActivity.main()'... :googleJavaFormat Version 0.6 of google-java-format-gradle-plugin is not tested against version 1.5 of google-java-format. This should not be a problem if the task is executed...
Here is the output ``` ➜ cadence-java-samples git:(master) ./gradlew build > Task :test com.uber.cadence.samples.fileprocessing.FileProcessingTest > testHappyPath FAILED org.junit.runners.model.TestTimedOutException at FileProcessingTest.java:100 com.uber.cadence.samples.fileprocessing.FileProcessingTest > testHostFailover FAILED org.junit.runners.model.TestTimedOutException at FileProcessingTest.java:100 20 tests completed,...
Will be good to have example on how to use activity heart beat.
The samples for mocking with Mockito don't work properly on newer versions due to https://github.com/mockito/mockito/issues/1206 -- the Mockito-generated class inherits the @ActivityMethod annotation and then cadence complains with an error...