File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/main/java/com/uber/cadence/samples/spring/workflows/impl Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 3
3
import com .uber .cadence .samples .spring .models .SampleMessage ;
4
4
import com .uber .cadence .samples .spring .workflows .SignalWorkflow ;
5
5
import com .uber .cadence .workflow .Workflow ;
6
+ import java .util .Optional ;
6
7
import org .slf4j .Logger ;
7
8
8
9
public class SignalWorkflowImpl implements SignalWorkflow {
@@ -22,6 +23,16 @@ public void getGreeting(SampleMessage sampleMessage) {
22
23
if (!this .greetingMsg .isEmpty ()) {
23
24
logger .info (++count + ": " + this .greetingMsg + "!" );
24
25
this .greetingMsg = "" ;
26
+
27
+ // A workflow execution cannot receive infinite number of signals due to history limit
28
+ // By default 10000 is MaximumSignalsPerExecution which can be configured by DynamicConfig of Cadence cluster.
29
+ // But it's recommended to do continueAsNew after receiving certain number of signals.
30
+ // in production, use a number <1000.
31
+ if (count == 3 ) {
32
+ Workflow .continueAsNew (
33
+ Optional .of ("SignalWorkflow::getGreeting" ), Optional .empty (), sampleMessage );
34
+ return ;
35
+ }
25
36
}
26
37
}
27
38
You can’t perform that action at this time.
0 commit comments