@@ -93,18 +93,27 @@ public function getTaskConfiguration(): ?TaskConfiguration
9393 public function execute (string $ processCode , mixed $ input = null , array $ context = []): mixed
9494 {
9595 try {
96- $ this ->eventDispatcher ->dispatch (new ProcessEvent ($ processCode , $ input , $ context ));
96+ $ this ->eventDispatcher ->dispatch (
97+ new ProcessEvent ($ processCode , $ input , $ context ),
98+ ProcessEvent::EVENT_PROCESS_STARTED
99+ );
97100 $ this ->processLogger ->debug ('Process start ' );
98101
99102 $ result = $ this ->doExecute ($ processCode , $ input , $ context );
100103
101104 $ this ->processLogger ->debug ('Process end ' );
102- $ this ->eventDispatcher ->dispatch (new ProcessEvent ($ processCode , $ input , $ context , $ result ));
105+ $ this ->eventDispatcher ->dispatch (
106+ new ProcessEvent ($ processCode , $ input , $ context , $ result ),
107+ ProcessEvent::EVENT_PROCESS_ENDED
108+ );
103109 } catch (Throwable $ error ) {
104110 $ this ->processLogger ->critical ('Critical process failure ' , [
105111 'error ' => $ error ->getMessage (),
106112 ]);
107- $ this ->eventDispatcher ->dispatch (new ProcessEvent ($ processCode , $ input , $ context , null , $ error ));
113+ $ this ->eventDispatcher ->dispatch (
114+ new ProcessEvent ($ processCode , $ input , $ context , null , $ error ),
115+ ProcessEvent::EVENT_PROCESS_FAILED
116+ );
108117
109118 throw $ error ;
110119 }
0 commit comments