Skip to content

Commit

Permalink
Yep, more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffail committed Jan 25, 2020
1 parent 9185d85 commit 2edb274
Show file tree
Hide file tree
Showing 14 changed files with 160 additions and 43 deletions.
4 changes: 2 additions & 2 deletions lib/output/kinesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
func init() {
Constructors[TypeKinesis] = TypeSpec{
constructor: NewKinesis,
Summary: `
Sends messages to a Kinesis stream.`,
Description: `
Sends messages to a Kinesis stream.
Both the ` + "`partition_key`" + `(required) and ` + "`hash_key`" + ` (optional)
fields can be dynamically set using function interpolations described
[here](/docs/configuration/interpolation#functions). When sending batched messages the
Expand Down
4 changes: 2 additions & 2 deletions lib/output/kinesis_firehose.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
func init() {
Constructors[TypeKinesisFirehose] = TypeSpec{
constructor: NewKinesisFirehose,
Summary: `
Sends messages to a Kinesis Firehose delivery stream.`,
Description: `
Sends messages to a Kinesis Firehose delivery stream.
### Credentials
By default Benthos will use a shared credentials file when connecting to AWS
Expand Down
2 changes: 1 addition & 1 deletion lib/output/mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ described [here](/docs/configuration/interpolation#functions). When sending batc
messages these interpolations are performed per message part.`,
Async: true,
FieldSpecs: docs.FieldSpecs{
docs.FieldCommon("urls", "A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.", []string{"http://localhost:9200"}),
docs.FieldCommon("urls", "A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.", []string{"tcp://localhost:1883"}),
docs.FieldCommon("qos", "The QoS value to set for each message.").HasOptions("0", "1", "2"),
docs.FieldCommon("topic", "The topic to publish messages to."),
docs.FieldCommon("client_id", "An identifier for the client."),
Expand Down
13 changes: 10 additions & 3 deletions lib/output/nanomsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,26 @@ import (
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/output/writer"
"github.com/Jeffail/benthos/v3/lib/types"
"github.com/Jeffail/benthos/v3/lib/x/docs"
)

//------------------------------------------------------------------------------

func init() {
Constructors["nanomsg"] = TypeSpec{
constructor: NewNanomsg,
Summary: `
Send messages over a Nanomsg socket.`,
Description: `
The scalability protocols are common communication patterns. This output should
be compatible with any implementation, but specifically targets Nanomsg.
Currently only PUSH and PUB sockets are supported.`,
Async: true,
FieldSpecs: docs.FieldSpecs{
docs.FieldCommon("urls", "A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.", []string{"tcp://localhost:5556"}),
docs.FieldCommon("bind", "Whether the URLs listed should be bind (otherwise they are connected to)."),
docs.FieldCommon("socket_type", "The socket type to send with.").HasOptions("PUSH", "PUB"),
docs.FieldCommon("poll_timeout", "The maximum period of time to wait for a message to send before the request is abandoned and reattempted."),
docs.FieldCommon("max_in_flight", "The maximum number of messages to have in flight at a given time. Increase this to improve throughput."),
},
}
}

Expand Down
11 changes: 8 additions & 3 deletions lib/output/nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,25 @@ import (
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/output/writer"
"github.com/Jeffail/benthos/v3/lib/types"
"github.com/Jeffail/benthos/v3/lib/x/docs"
)

//------------------------------------------------------------------------------

func init() {
Constructors[TypeNATS] = TypeSpec{
constructor: NewNATS,
Summary: `
Publish to an NATS subject.`,
Description: `
Publish to an NATS subject. NATS is at-most-once, so delivery is not guaranteed.
For at-least-once behaviour with NATS look at NATS Stream.
This output will interpolate functions within the subject field, you
can find a list of functions [here](/docs/configuration/interpolation#functions).`,
Async: true,
FieldSpecs: docs.FieldSpecs{
docs.FieldCommon("urls", "A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs."),
docs.FieldCommon("subject", "The subject to publish to.").SupportsInterpolation(false),
docs.FieldCommon("max_in_flight", "The maximum number of messages to have in flight at a given time. Increase this to improve throughput."),
},
}
}

Expand Down
10 changes: 9 additions & 1 deletion lib/output/nats_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ import (
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/output/writer"
"github.com/Jeffail/benthos/v3/lib/types"
"github.com/Jeffail/benthos/v3/lib/x/docs"
)

//------------------------------------------------------------------------------

func init() {
Constructors[TypeNATSStream] = TypeSpec{
constructor: NewNATSStream,
Description: `
Summary: `
Publish to a NATS Stream subject.`,
Async: true,
FieldSpecs: docs.FieldSpecs{
docs.FieldCommon("urls", "A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs."),
docs.FieldCommon("cluster_id", "The cluster ID to publish to."),
docs.FieldCommon("subject", "The subject to publish to."),
docs.FieldCommon("client_id", "The client ID to connect with."),
docs.FieldCommon("max_in_flight", "The maximum number of messages to have in flight at a given time. Increase this to improve throughput."),
},
}
}

Expand Down
16 changes: 12 additions & 4 deletions lib/output/nsq.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,27 @@ import (
"github.com/Jeffail/benthos/v3/lib/metrics"
"github.com/Jeffail/benthos/v3/lib/output/writer"
"github.com/Jeffail/benthos/v3/lib/types"
"github.com/Jeffail/benthos/v3/lib/x/docs"
)

//------------------------------------------------------------------------------

func init() {
Constructors[TypeNSQ] = TypeSpec{
constructor: NewNSQ,
Summary: `
Publish to an NSQ topic.`,
Description: `
Publish to an NSQ topic. The ` + "`topic`" + ` field can be dynamically set
using function interpolations described
[here](/docs/configuration/interpolation#functions). When sending batched messages
these interpolations are performed per message part.`,
The ` + "`topic`" + ` field can be dynamically set using function interpolations
described [here](/docs/configuration/interpolation#functions). When sending
batched messages these interpolations are performed per message part.`,
Async: true,
FieldSpecs: docs.FieldSpecs{
docs.FieldCommon("nsqd_tcp_address", "The address of the target NSQD server."),
docs.FieldCommon("topic", "The topic to publish to.").SupportsInterpolation(false),
docs.FieldCommon("user_agent", "A user agent string to connect with."),
docs.FieldCommon("max_in_flight", "The maximum number of messages to have in flight at a given time. Increase this to improve throughput."),
},
}
}

Expand Down
4 changes: 2 additions & 2 deletions website/docs/components/outputs/kinesis.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type: output
-->


Sends messages to a Kinesis stream.


import Tabs from '@theme/Tabs';

Expand Down Expand Up @@ -72,8 +74,6 @@ output:
</TabItem>
</Tabs>
Sends messages to a Kinesis stream.
Both the `partition_key`(required) and `hash_key` (optional)
fields can be dynamically set using function interpolations described
[here](/docs/configuration/interpolation#functions). When sending batched messages the
Expand Down
4 changes: 2 additions & 2 deletions website/docs/components/outputs/kinesis_firehose.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type: output
-->


Sends messages to a Kinesis Firehose delivery stream.


import Tabs from '@theme/Tabs';

Expand Down Expand Up @@ -69,8 +71,6 @@ output:
</TabItem>
</Tabs>
Sends messages to a Kinesis Firehose delivery stream.
### Credentials
By default Benthos will use a shared credentials file when connecting to AWS
Expand Down
2 changes: 1 addition & 1 deletion website/docs/components/outputs/mqtt.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ field `max_in_flight`.
# Examples
urls:
- http://localhost:9200
- tcp://localhost:1883
```

### `qos`
Expand Down
44 changes: 37 additions & 7 deletions website/docs/components/outputs/nanomsg.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,54 @@ type: output
-->


Send messages over a Nanomsg socket.

```yaml
output:
nanomsg:
bind: false
max_in_flight: 1
poll_timeout: 5s
socket_type: PUSH
urls:
- tcp://localhost:5556
bind: false
socket_type: PUSH
poll_timeout: 5s
max_in_flight: 1
```
The scalability protocols are common communication patterns. This output should
be compatible with any implementation, but specifically targets Nanomsg.
Currently only PUSH and PUB sockets are supported.
This output benefits from sending multiple messages in flight in parallel for
improved performance. You can tune the max number of in flight messages with the
field `max_in_flight`.

## Fields

### `urls`

`array` A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.

```yaml
# Examples
urls:
- tcp://localhost:5556
```

### `bind`

`bool` Whether the URLs listed should be bind (otherwise they are connected to).

### `socket_type`

`string` The socket type to send with.

Options are: `PUSH`, `PUB`.

### `poll_timeout`

`string` The maximum period of time to wait for a message to send before the request is abandoned and reattempted.

### `max_in_flight`

`number` The maximum number of messages to have in flight at a given time. Increase this to improve throughput.


25 changes: 20 additions & 5 deletions website/docs/components/outputs/nats.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,38 @@ type: output
-->


Publish to an NATS subject.

```yaml
output:
nats:
max_in_flight: 1
subject: benthos_messages
urls:
- nats://127.0.0.1:4222
subject: benthos_messages
max_in_flight: 1
```
Publish to an NATS subject. NATS is at-most-once, so delivery is not guaranteed.
For at-least-once behaviour with NATS look at NATS Stream.
This output will interpolate functions within the subject field, you
can find a list of functions [here](/docs/configuration/interpolation#functions).
This output benefits from sending multiple messages in flight in parallel for
improved performance. You can tune the max number of in flight messages with the
field `max_in_flight`.

## Fields

### `urls`

`array` A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.

### `subject`

`string` The subject to publish to.

This field supports [interpolation functions](/docs/configuration/interpolation#functions).

### `max_in_flight`

`number` The maximum number of messages to have in flight at a given time. Increase this to improve throughput.


33 changes: 28 additions & 5 deletions website/docs/components/outputs/nats_stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,44 @@ type: output
-->


Publish to a NATS Stream subject.

```yaml
output:
nats_stream:
client_id: benthos_client
cluster_id: test-cluster
max_in_flight: 1
subject: benthos_messages
urls:
- nats://127.0.0.1:4222
cluster_id: test-cluster
subject: benthos_messages
client_id: benthos_client
max_in_flight: 1
```
Publish to a NATS Stream subject.
This output benefits from sending multiple messages in flight in parallel for
improved performance. You can tune the max number of in flight messages with the
field `max_in_flight`.

## Fields

### `urls`

`array` A list of URLs to connect to. If an item of the list contains commas it will be expanded into multiple URLs.

### `cluster_id`

`string` The cluster ID to publish to.

### `subject`

`string` The subject to publish to.

### `client_id`

`string` The client ID to connect with.

### `max_in_flight`

`number` The maximum number of messages to have in flight at a given time. Increase this to improve throughput.


31 changes: 26 additions & 5 deletions website/docs/components/outputs/nsq.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,43 @@ type: output
-->


Publish to an NSQ topic.

```yaml
output:
nsq:
max_in_flight: 1
nsqd_tcp_address: localhost:4150
topic: benthos_messages
user_agent: benthos_producer
max_in_flight: 1
```
Publish to an NSQ topic. The `topic` field can be dynamically set
using function interpolations described
[here](/docs/configuration/interpolation#functions). When sending batched messages
these interpolations are performed per message part.
The `topic` field can be dynamically set using function interpolations
described [here](/docs/configuration/interpolation#functions). When sending
batched messages these interpolations are performed per message part.

This output benefits from sending multiple messages in flight in parallel for
improved performance. You can tune the max number of in flight messages with the
field `max_in_flight`.

## Fields

### `nsqd_tcp_address`

`string` The address of the target NSQD server.

### `topic`

`string` The topic to publish to.

This field supports [interpolation functions](/docs/configuration/interpolation#functions).

### `user_agent`

`string` A user agent string to connect with.

### `max_in_flight`

`number` The maximum number of messages to have in flight at a given time. Increase this to improve throughput.


0 comments on commit 2edb274

Please sign in to comment.