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

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