github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/outputs/fallback.md (about)

     1  ---
     2  title: fallback
     3  type: output
     4  status: stable
     5  categories: ["Utility"]
     6  ---
     7  
     8  <!--
     9       THIS FILE IS AUTOGENERATED!
    10  
    11       To make changes please edit the contents of:
    12       lib/output/fallback.go
    13  -->
    14  
    15  import Tabs from '@theme/Tabs';
    16  import TabItem from '@theme/TabItem';
    17  
    18  
    19  Attempts to send each message to a child output, starting from the first output on the list. If an output attempt fails then the next output in the list is attempted, and so on.
    20  
    21  Introduced in version 3.58.0.
    22  
    23  ```yaml
    24  # Config fields, showing default values
    25  output:
    26    label: ""
    27    fallback: []
    28  ```
    29  
    30  This pattern is useful for triggering events in the case where certain output targets have broken. For example, if you had an output type `http_client` but wished to reroute messages whenever the endpoint becomes unreachable you could use this pattern:
    31  
    32  ```yaml
    33  output:
    34    fallback:
    35      - http_client:
    36          url: http://foo:4195/post/might/become/unreachable
    37          retries: 3
    38          retry_period: 1s
    39      - http_client:
    40          url: http://bar:4196/somewhere/else
    41          retries: 3
    42          retry_period: 1s
    43        processors:
    44          - bloblang: 'root = "failed to send this message to foo: " + content()'
    45      - file:
    46          path: /usr/local/benthos/everything_failed.jsonl
    47  ```
    48  
    49  ### Batching
    50  
    51  When an output within a fallback sequence uses batching, like so:
    52  
    53  ```yaml
    54  output:
    55    fallback:
    56      - aws_dynamodb:
    57          table: foo
    58          string_columns:
    59            id: ${!json("id")}
    60            content: ${!content()}
    61          batching:
    62            count: 10
    63            period: 1s
    64      - file:
    65          path: /usr/local/benthos/failed_stuff.jsonl
    66  ```
    67  
    68  Benthos makes a best attempt at inferring which specific messages of the batch failed, and only propagates those individual messages to the next fallback tier.
    69  
    70  However, depending on the output and the error returned it is sometimes not possible to determine the individual messages that failed, in which case the whole batch is passed to the next tier in order to preserve at-least-once delivery guarantees.
    71  
    72