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

     1  ---
     2  title: schema_registry_encode
     3  type: processor
     4  status: experimental
     5  categories: ["Parsing","Integration"]
     6  ---
     7  
     8  <!--
     9       THIS FILE IS AUTOGENERATED!
    10  
    11       To make changes please edit the contents of:
    12       lib/processor/schema_registry_encode.go
    13  -->
    14  
    15  import Tabs from '@theme/Tabs';
    16  import TabItem from '@theme/TabItem';
    17  
    18  :::caution EXPERIMENTAL
    19  This component is experimental and therefore subject to change or removal outside of major version releases.
    20  :::
    21  Automatically encodes and validates messages with schemas from a Confluent Schema Registry service.
    22  
    23  Introduced in version 3.58.0.
    24  
    25  
    26  <Tabs defaultValue="common" values={[
    27    { label: 'Common', value: 'common', },
    28    { label: 'Advanced', value: 'advanced', },
    29  ]}>
    30  
    31  <TabItem value="common">
    32  
    33  ```yaml
    34  # Common config fields, showing default values
    35  label: ""
    36  schema_registry_encode:
    37    url: ""
    38    subject: ""
    39    refresh_period: 10m
    40  ```
    41  
    42  </TabItem>
    43  <TabItem value="advanced">
    44  
    45  ```yaml
    46  # All config fields, showing default values
    47  label: ""
    48  schema_registry_encode:
    49    url: ""
    50    subject: ""
    51    refresh_period: 10m
    52    avro_raw_json: false
    53    tls:
    54      skip_cert_verify: false
    55      enable_renegotiation: false
    56      root_cas: ""
    57      root_cas_file: ""
    58      client_certs: []
    59  ```
    60  
    61  </TabItem>
    62  </Tabs>
    63  
    64  Encodes messages automatically from schemas obtains from a [Confluent Schema Registry service](https://docs.confluent.io/platform/current/schema-registry/index.html) by polling the service for the latest schema version for target subjects.
    65  
    66  If a message fails to encode under the schema then it will remain unchanged and the error can be caught using error handling methods outlined [here](/docs/configuration/error_handling).
    67  
    68  Currently only Avro schemas are supported.
    69  
    70  ### Avro JSON Format
    71  
    72  By default this processor expects documents formatted as [Avro JSON](https://avro.apache.org/docs/current/spec.html#json_encoding) when encoding Avro schemas. In this format the value of a union is encoded in JSON as follows:
    73  
    74  - if its type is `null`, then it is encoded as a JSON `null`;
    75  - otherwise it is encoded as a JSON object with one name/value pair whose name is the type's name and whose value is the recursively encoded value. For Avro's named types (record, fixed or enum) the user-specified name is used, for other types the type name is used.
    76  
    77  For example, the union schema `["null","string","Foo"]`, where `Foo` is a record name, would encode:
    78  
    79  - `null` as `null`;
    80  - the string `"a"` as `{"string": "a"}`; and
    81  - a `Foo` instance as `{"Foo": {...}}`, where `{...}` indicates the JSON encoding of a `Foo` instance.
    82  
    83  However, it is possible to instead consume documents in raw JSON format (that match the schema) by setting the field [`avro_raw_json`](#avro_raw_json) to `true`.
    84  
    85  ## Fields
    86  
    87  ### `url`
    88  
    89  The base URL of the schema registry service.
    90  
    91  
    92  Type: `string`  
    93  
    94  ### `subject`
    95  
    96  The schema subject to derive schemas from.
    97  This field supports [interpolation functions](/docs/configuration/interpolation#bloblang-queries).
    98  
    99  
   100  Type: `string`  
   101  
   102  ```yaml
   103  # Examples
   104  
   105  subject: foo
   106  
   107  subject: ${! meta("kafka_topic") }
   108  ```
   109  
   110  ### `refresh_period`
   111  
   112  The period after which a schema is refreshed for each subject, this is done by polling the schema registry service.
   113  
   114  
   115  Type: `string`  
   116  Default: `"10m"`  
   117  
   118  ```yaml
   119  # Examples
   120  
   121  refresh_period: 60s
   122  
   123  refresh_period: 1h
   124  ```
   125  
   126  ### `avro_raw_json`
   127  
   128  Whether messages encoded in Avro format should be parsed as raw JSON documents rather than [Avro JSON](https://avro.apache.org/docs/current/spec.html#json_encoding).
   129  
   130  
   131  Type: `bool`  
   132  Default: `false`  
   133  Requires version 3.59.0 or newer  
   134  
   135  ### `tls`
   136  
   137  Custom TLS settings can be used to override system defaults.
   138  
   139  
   140  Type: `object`  
   141  
   142  ### `tls.skip_cert_verify`
   143  
   144  Whether to skip server side certificate verification.
   145  
   146  
   147  Type: `bool`  
   148  Default: `false`  
   149  
   150  ### `tls.enable_renegotiation`
   151  
   152  Whether to allow the remote server to repeatedly request renegotiation. Enable this option if you're seeing the error message `local error: tls: no renegotiation`.
   153  
   154  
   155  Type: `bool`  
   156  Default: `false`  
   157  Requires version 3.45.0 or newer  
   158  
   159  ### `tls.root_cas`
   160  
   161  An optional root certificate authority to use. This is a string, representing a certificate chain from the parent trusted root certificate, to possible intermediate signing certificates, to the host certificate.
   162  
   163  
   164  Type: `string`  
   165  Default: `""`  
   166  
   167  ```yaml
   168  # Examples
   169  
   170  root_cas: |-
   171    -----BEGIN CERTIFICATE-----
   172    ...
   173    -----END CERTIFICATE-----
   174  ```
   175  
   176  ### `tls.root_cas_file`
   177  
   178  An optional path of a root certificate authority file to use. This is a file, often with a .pem extension, containing a certificate chain from the parent trusted root certificate, to possible intermediate signing certificates, to the host certificate.
   179  
   180  
   181  Type: `string`  
   182  Default: `""`  
   183  
   184  ```yaml
   185  # Examples
   186  
   187  root_cas_file: ./root_cas.pem
   188  ```
   189  
   190  ### `tls.client_certs`
   191  
   192  A list of client certificates to use. For each certificate either the fields `cert` and `key`, or `cert_file` and `key_file` should be specified, but not both.
   193  
   194  
   195  Type: `array`  
   196  
   197  ```yaml
   198  # Examples
   199  
   200  client_certs:
   201    - cert: foo
   202      key: bar
   203  
   204  client_certs:
   205    - cert_file: ./example.pem
   206      key_file: ./example.key
   207  ```
   208  
   209  ### `tls.client_certs[].cert`
   210  
   211  A plain text certificate to use.
   212  
   213  
   214  Type: `string`  
   215  Default: `""`  
   216  
   217  ### `tls.client_certs[].key`
   218  
   219  A plain text certificate key to use.
   220  
   221  
   222  Type: `string`  
   223  Default: `""`  
   224  
   225  ### `tls.client_certs[].cert_file`
   226  
   227  The path to a certificate to use.
   228  
   229  
   230  Type: `string`  
   231  Default: `""`  
   232  
   233  ### `tls.client_certs[].key_file`
   234  
   235  The path of a certificate key to use.
   236  
   237  
   238  Type: `string`  
   239  Default: `""`  
   240  
   241