File tree Expand file tree Collapse file tree
impl/core/src/main/java/io/serverlessworkflow/impl/executors Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,8 +51,7 @@ public static class ListenExecutorBuilder extends RegularTaskExecutorBuilder<Lis
5151
5252 private EventRegistrationBuilderInfo registrationInfo ;
5353 private TaskExecutor <?> loop ;
54- private Function <CloudEvent , WorkflowModel > converter =
55- ce -> application .modelFactory ().from (ce .getData ());
54+ private final Function <CloudEvent , WorkflowModel > converter ;
5655
5756 protected ListenExecutorBuilder (
5857 WorkflowMutablePosition position , ListenTask task , WorkflowDefinition definition ) {
@@ -65,16 +64,10 @@ protected ListenExecutorBuilder(
6564 loop = TaskExecutorHelper .createExecutorList (position , forEach .getDo (), definition );
6665 }
6766 ListenAndReadAs readAs = listen .getRead ();
68- if (readAs != null ) {
69- switch (readAs ) {
70- case ENVELOPE :
71- converter = ce -> application .modelFactory ().from (ce );
72- default :
73- case DATA :
74- converter = ce -> application .modelFactory ().from (ce .getData ());
75- break ;
76- }
77- }
67+ converter =
68+ readAs == ListenAndReadAs .ENVELOPE
69+ ? application .modelFactory ()::from
70+ : ce -> application .modelFactory ().from (ce .getData ());
7871 }
7972
8073 protected WorkflowPredicate buildUntilPredicate (Until until ) {
You can’t perform that action at this time.
0 commit comments