forked from redpanda-data/connect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of a Cassandra output. (redpanda-data#543)
* Initial Cassandra implementation * Generated documentation * Added documentation for fields Co-authored-by: codingconcepts <[email protected]>
- Loading branch information
1 parent
523a32d
commit 0234400
Showing
8 changed files
with
620 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# This file was auto generated by benthos_config_gen. | ||
http: | ||
address: 0.0.0.0:4195 | ||
enabled: true | ||
read_timeout: 5s | ||
root_path: /benthos | ||
debug_endpoints: false | ||
input: | ||
type: stdin | ||
stdin: | ||
delimiter: "" | ||
max_buffer: 1000000 | ||
multipart: false | ||
buffer: | ||
type: none | ||
none: {} | ||
pipeline: | ||
processors: [] | ||
threads: 1 | ||
output: | ||
type: cassandra | ||
cassandra: | ||
async: true | ||
backoff: | ||
initial_interval: 1s | ||
max_elapsed_time: 30s | ||
max_interval: 5s | ||
consistency: QUORUM | ||
keyspace: benthos | ||
max_retries: 3 | ||
nodes: | ||
- localhost:9042 | ||
password_authenticator: | ||
enabled: true | ||
password: cassandra | ||
username: cassandra | ||
table: benthos | ||
resources: | ||
caches: {} | ||
conditions: {} | ||
inputs: {} | ||
outputs: {} | ||
processors: {} | ||
rate_limits: {} | ||
logger: | ||
prefix: benthos | ||
level: INFO | ||
add_timestamp: true | ||
json_format: true | ||
static_fields: | ||
'@service': benthos | ||
metrics: | ||
type: http_server | ||
http_server: | ||
path_mapping: "" | ||
prefix: benthos | ||
tracer: | ||
type: none | ||
none: {} | ||
shutdown_timeout: 20s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package output | ||
|
||
import ( | ||
"github.com/Jeffail/benthos/v3/internal/docs" | ||
"github.com/Jeffail/benthos/v3/lib/log" | ||
"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/util/retries" | ||
) | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
func init() { | ||
Constructors[TypeCassandra] = TypeSpec{ | ||
constructor: NewCassandra, | ||
Summary: ` | ||
Send messages to a Cassandra database.`, | ||
Description: ` | ||
This output will send messages to a Cassandra database using the INSERT JSON functionality | ||
provided by the database (https://cassandra.apache.org/doc/latest/cql/json.html#insert-json).`, | ||
FieldSpecs: docs.FieldSpecs{ | ||
docs.FieldAdvanced( | ||
"nodes", | ||
"A list of Cassandra nodes to connect to.", | ||
[]string{"localhost:9042"}), | ||
docs.FieldAdvanced( | ||
"password_authenticator", | ||
"An object containing the username and password.", | ||
writer.PasswordAuthenticator{Enabled: true, Username: "cassandra", Password: "cassandra"}), | ||
docs.FieldAdvanced( | ||
"keyspace", | ||
"The name of the Cassandra keyspace to use.", | ||
"benthos"), | ||
docs.FieldAdvanced( | ||
"table", | ||
"The name of the Cassandra table to use.", | ||
"benthos"), | ||
docs.FieldAdvanced( | ||
"consistency", | ||
"The consistency level to use.", | ||
"ANY", "ONE", "TWO", "THREE", "QUORUM", "ALL", "LOCAL_QUORUM", "EACH_QUORUM", "LOCAL_ONE"), | ||
docs.FieldAdvanced( | ||
"async", | ||
"A flag to determine whether inserts will be performed concurrently.", | ||
true, false), | ||
docs.FieldAdvanced( | ||
"backoff", | ||
"The mechanism used to provided retries at increasing intervals.", | ||
retries.Backoff{InitialInterval: "1s", MaxInterval: "5s", MaxElapsedTime: "30s"}), | ||
docs.FieldAdvanced( | ||
"max_retries", | ||
"The maximum number of retries to attempt.", | ||
10), | ||
}, | ||
} | ||
} | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
// NewCassandra creates a new Cassandra output type. | ||
func NewCassandra(conf Config, mgr types.Manager, log log.Modular, stats metrics.Type) (Type, error) { | ||
c, err := writer.NewCassandra(conf.Cassandra, log, stats) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return NewWriter( | ||
TypeCassandra, c, log, stats, | ||
) | ||
} | ||
|
||
//------------------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.