1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Events that a workflow run dispatches when it ends.
//!
//! The run's jobs also dispatch the queue's [`JobProcessed`](crate::queue::events::JobProcessed)
//! and [`JobFailed`](crate::queue::events::JobFailed) events. Listeners run in the run's context,
//! so they see the context values the run started with:
//!
//! ```
//! use laravel::Application;
//! use laravel::event::Event;
//! use laravel::workflow::events::RunFailed;
//!
//! Application::configure().with_events(|events, _| {
//! events.listen(|event: Event<RunFailed>| async move {
//! tracing::error!(run = %event.run_id, error = %event.error, "A workflow run failed");
//! });
//! });
//! ```
use RunId;
/// Dispatched when a run's workflow returns.
/// Dispatched when [`workflow::cancel`](super::cancel) or `workflow:cancel` cancels a run.
///
/// Listeners run in the context of the code that cancelled the run.
/// Dispatched when a run fails for good, after the workflow's `failed` hook runs.
///
/// Laravel also reports the failure to the error handler, as it does for a failed job.