github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/conditions/count.md (about) 1 --- 2 title: count 3 type: condition 4 status: stable 5 --- 6 7 <!-- 8 THIS FILE IS AUTOGENERATED! 9 10 To make changes please edit the contents of: 11 lib/condition/count.go 12 --> 13 14 import Tabs from '@theme/Tabs'; 15 import TabItem from '@theme/TabItem'; 16 17 18 Counts messages starting from one, returning true until the counter reaches its 19 target, at which point it will return false and reset the counter. 20 21 ```yaml 22 # Config fields, showing default values 23 count: 24 arg: 100 25 ``` 26 27 Each discrete count condition will have its own counter. Parallel processors 28 containing a count condition will therefore count independently. It is, however, 29 possible to share the counter across processor pipelines by defining the count 30 condition as a resource. 31 32 ## Fields 33 34 ### `arg` 35 36 A number to count towards. 37 38 39 Type: `number` 40 Default: `100` 41 42 ## Examples 43 44 This condition is useful when paired with the 45 [`read_until`](/docs/components/inputs/read_until) input, as it can be 46 used to cut the input stream off once a certain number of messages have been 47 read: 48 49 ```yaml 50 # Only read 100 messages, and then exit. 51 input: 52 read_until: 53 input: 54 kafka: 55 addresses: [ TODO ] 56 topics: [ foo, bar ] 57 consumer_group: foogroup 58 condition: 59 not: 60 count: 61 arg: 100 62 ``` 63