github.com/Jeffail/benthos/v3@v3.65.0/website/docs/guides/migration/v2.md (about) 1 --- 2 title: Migrating to Version 2 3 --- 4 5 Benthos version 2 comes with a small number of backwards incompatible changes 6 that are organised into three sections; [configuration](#configuration), 7 [service](#service) and [Go API](#go-api). 8 9 These changes are considered minor and therefore upgrading is not expected to 10 cause significant problems for any users. 11 12 ## Configuration 13 14 ### Type Inference 15 16 Version 2 comes with the ability to infer the `type` of components in 17 configuration files whenever the field is omitted. You can read more about this 18 behaviour [here](/docs/configuration/about#concise-configuration). 19 20 This feature is not expected to impact the vast majority of users. However, 21 there is one exception where a malformed section containing unused type 22 parameters but a missing `type` field will be interpreted differently. For 23 example, the following config: 24 25 ```yml 26 pipeline: 27 processors: 28 - # type: text 29 text: 30 operator: set 31 value: "delete all your content" 32 ``` 33 34 In V1 would be interpreted as a `bounds_check` processor as it is the default 35 processor type, whereas V2 would infer this to be a `text` processor based on 36 its fields. 37 38 #### Migration Guide 39 40 Most users should not be impacted by this change, and a config file that is 41 vulnerable to the regression would report linting errors in V1. 42 43 You can quickly verify that your configs are interpreted without regression by 44 comparing the output of `benthos -c ./yourconfig.yaml --print-yaml` with V1 and 45 V2. If they are the same then you are not affected. 46 47 ### Field Default Value Changes 48 49 In version 2 the field `unsubscribe_on_close` of the `nats_stream` input is now 50 `false` by default. 51 52 ## Service 53 54 The recommended way to create plugins for Benthos is outlined in 55 [this repository](https://github.com/benthosdev/benthos-plugin-example). 56 Therefore the following experimental plugin related flags have been removed from 57 the service: `swap-envs`, `plugins-dir`, `list-input-plugins`, 58 `list-output-plugins`, `list-processor-plugins`, `list-condition-plugins`. 59 60 The flag `swap-envs` has also been removed for clarity, as it had no impact on 61 JSON reference resolution. If this flag is being used please open an issue and 62 it can be reimplemented to be fully compliant. 63 64 ## Go API 65 66 ### Condition Package Moved 67 68 The package `github.com/Jeffail/benthos/lib/processor/condition` has been 69 changed to `github.com/Jeffail/benthos/lib/condition`. Migrating should be a 70 simple case of applying a find/replace on your codebase: 71 72 ```sh 73 find . -name "*.go" | \ 74 xargs sed -i 's/benthos\/lib\/processor\/condition/benthos\/lib\/condition/g' 75 ``` 76 77 ### Interface Changes 78 79 The following interface changes have occurred to core Benthos components: 80 81 - `types.Cache` now has `types.Closable` embedded. 82 - `types.RateLimit` now has `types.Closable` embedded. 83 - `types.Manager` has new method `GetPlugin`. 84 - `log.Modular` has new method `WithFields`.