What will happen if my workflow code throws an exception?
Won’t it fail my execution ?
What will happen if my workflow code throws an exception?
Won’t it fail my execution ?
By default unexpected workflow exceptions that do not extend TemporalFailure do not fail a workflow. In those cases workflow blocks its execution and retries periodically. This is done in order to avoid exceptions such as NullPointerExceptions to fail workflow execution.
If you do want to fail workflow execution on some exceptions, make sure to include them in WorkflowImplementationOptions.setFailWorkflowExceptionTypes
Thank you!
I tried it is working.
In my case, I wanted to do pre-process and post-process of my input before perform the activity execution, it may throw an exception like InputProcessing Failure.
In such a scenario, Do I need to perform my pre-process and post-process in the activity method or I can have it in workflow code?
If pre-precessing doesn’t involve external calls then you can do it in either place. If it involves external calls then it should live in an activity.
If you want some sort of generic pre/post processing you can implement it as an interceptor. See WorkerInterceptor.