1212use Yuges \Processable \Models \FailedJob ;
1313use Yuges \Processable \Enums \ProcessState ;
1414use Yuges \Processable \Jobs \ProcessStageJob ;
15+ use Yuges \Processable \Handlers \EventHandler ;
1516use Yuges \Processable \Interfaces \Processable ;
17+ use Yuges \Processable \Actions \CreateJobAction ;
1618use Yuges \Processable \Observers \StageObserver ;
1719use Yuges \Processable \Actions \RunProcessAction ;
1820use Yuges \Processable \Observers \ProcessObserver ;
1921use Yuges \Processable \Handlers \StageEventHandler ;
2022use Yuges \Processable \Actions \UpdateProcessAction ;
2123use Yuges \Processable \Actions \CreateProcessAction ;
24+ use Yuges \Processable \Handlers \ProcessEventHandler ;
2225use Yuges \Processable \Observers \ProcessableObserver ;
2326use Yuges \Processable \Actions \UpdateProcessStageAction ;
2427use Yuges \Processable \Actions \CreateProcessStagesAction ;
@@ -228,6 +231,21 @@ public static function getProcessStateClass(mixed $default = null): string
228231 return self ::get ('process.state ' , $ default );
229232 }
230233
234+ public static function getCreateJobAction (
235+ Process $ process ,
236+ Processable $ processable ,
237+ mixed $ default = null
238+ ): CreateJobAction
239+ {
240+ return self ::getCreateJobActionClass ($ default )::create ($ process , $ processable );
241+ }
242+
243+ /** @return class-string<CreateJobAction> */
244+ public static function getCreateJobActionClass (mixed $ default = null ): string
245+ {
246+ return self ::get ('actions.job.create ' , $ default );
247+ }
248+
231249 public static function getRunProcessAction (
232250 Processable $ processable ,
233251 mixed $ default = null
@@ -316,6 +334,17 @@ public static function getProcessStageJobClass(mixed $default = null): string
316334 return self ::get ('job.class ' , $ default );
317335 }
318336
337+ public static function getEventHandler (mixed $ default = null ): EventHandler
338+ {
339+ return self ::getEventHandlerClass ($ default )::create ();
340+ }
341+
342+ /** @return class-string<EventHandler> */
343+ public static function getEventHandlerClass (mixed $ default = null ): string
344+ {
345+ return self ::get ('job.handler.event ' , $ default );
346+ }
347+
319348 public static function getStageEventHandler (mixed $ default = null ): StageEventHandler
320349 {
321350 return self ::getStageEventHandlerClass ($ default )::create ();
@@ -327,6 +356,17 @@ public static function getStageEventHandlerClass(mixed $default = null): string
327356 return self ::get ('job.handler.stage ' , $ default );
328357 }
329358
359+ public static function getProcessEventHandler (mixed $ default = null ): ProcessEventHandler
360+ {
361+ return self ::getProcessEventHandlerClass ($ default )::create ();
362+ }
363+
364+ /** @return class-string<ProcessEventHandler> */
365+ public static function getProcessEventHandlerClass (mixed $ default = null ): string
366+ {
367+ return self ::get ('job.handler.process ' , $ default );
368+ }
369+
330370 public static function getQueueName (mixed $ default = null ): string
331371 {
332372 return self ::get ('job.queue.name ' , $ default );
0 commit comments