Skip to content

Commit 195509e

Browse files
authored
DOC-1048 Add crash processor (#183)
1 parent 83687a9 commit 195509e

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
*** xref:components:processors/command.adoc[]
136136
*** xref:components:processors/compress.adoc[]
137137
*** xref:components:processors/couchbase.adoc[]
138+
*** xref:components:processors/crash.adoc[]
138139
*** xref:components:processors/decompress.adoc[]
139140
*** xref:components:processors/dedupe.adoc[]
140141
*** xref:components:processors/for_each.adoc[]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
= crash
2+
:type: processor
3+
:categories: ["Utility"]
4+
5+
Stops the current pipeline process with a fatal log message. You can use xref:configuration:interpolation.adoc#bloblang-queries[function interpolations] to define the log message, including the message contents and metadata that caused the fatal error.
6+
7+
```yml
8+
# Configuration fields, showing default values
9+
label: ""
10+
crash: "" # No default (required)
11+
```
12+
This processor is useful for detecting unhandled errors during development and testing. For more information about common patterns for trapping errors, see xref:configuration:error_handling.adoc[Error Handling].
13+
14+
== Fields
15+
16+
=== `crash`
17+
18+
Define the fatal log message that is written when an unhandled error occurs. This field supports xref:configuration:interpolation.adoc#bloblang-queries[function interpolations].
19+
20+
```
21+
# Examples
22+
23+
crash: "Processor ${!error_source_label()} failed due to: ${!error()}"
24+
25+
```

modules/configuration/pages/error_handling.adoc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33

44
Redpanda Connect supports a range of xref:components:processors/about.adoc[processors], such as `http` and `aws_lambda`, that may fail when retry attempts are exhausted. When a processor fails, the message data continues through the pipeline mostly unchanged, except for the addition of a metadata flag, which you can use for handling errors.
55

6+
ifndef::env-cloud[]
7+
This topic explains some common error-handling patterns, including dropping messages, recovering them with more processing, and routing them to a dead-letter queue. It also shows how to combine these approaches, where appropriate, and provides a method for <<logging-fatal-errors, trapping unhandled errors>>.
8+
endif::[]
9+
ifdef::env-cloud[]
610
This topic explains some common error-handling patterns, including dropping messages, recovering them with more processing, and routing them to a dead-letter queue. It also shows how to combine these approaches, where appropriate.
11+
endif::[]
712

813
== Abandon on failure
914

@@ -95,6 +100,22 @@ pipeline:
95100
root.meta.error = error()
96101
----
97102

103+
ifndef::env-cloud[]
104+
=== Logging fatal errors
105+
106+
During development and testing, you can use the xref:components:processors/crash.adoc[`crash` processor] to halt pipeline execution and log a fatal message when an unhandled error occurs. Use Bloblang functions to customize the message. For example:
107+
108+
[source,yaml]
109+
----
110+
pipeline:
111+
processors:
112+
- resource: processor_1 # Processor that might fail
113+
- catch:
114+
# Writes a custom fatal log message
115+
- crash: "Processing failed at ${!error_source_label()} due to: ${!error()}"
116+
----
117+
endif::[]
118+
98119
== Attempt until success
99120

100121
To process a particular message until it is successful, try using a xref:components:processors/retry.adoc[`retry`] processor:

0 commit comments

Comments
 (0)