Skip to content

Commit

Permalink
fix apache#635: cassandra sink and source kamelets problems
Browse files Browse the repository at this point in the history
    cassandra-sink:
        there is no cql parameter defined
        username and password must be optional
        preparedStatement was of a wrong type (string but it is actually boolean)

    cassandra-source:
        username and password must be optional
  • Loading branch information
valdar committed Dec 16, 2021
1 parent 1af8872 commit 57cad33
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 49 deletions.
19 changes: 8 additions & 11 deletions docs/modules/ROOT/pages/cassandra-sink.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ The following table summarizes the configuration options available for the `cass
| *connectionHost {empty}* *| Connection Host| Hostname(s) cassandra server(s). Multiple hosts can be separated by comma.| string| | `"localhost"`
| *connectionPort {empty}* *| Connection Port| Port number of cassandra server(s)| string| | `9042`
| *keyspace {empty}* *| Keyspace| Keyspace to use| string| | `"customers"`
| *password {empty}* *| Password| The password to use for accessing a secured Cassandra Cluster| string| |
| *preparedStatement {empty}* *| Prepared Statement| The Prepared statement to execute against the Cassandra cluster table| string| |
| *username {empty}* *| Username| The username to use for accessing a secured Cassandra Cluster| string| |
| *query {empty}* *| Query| The query to execute against the Cassandra cluster table| string| |
| consistencyLevel| Consistency Level| Consistency level to use. The value can be one of ANY, ONE, TWO, THREE, QUORUM, ALL, LOCAL_QUORUM, EACH_QUORUM, SERIAL, LOCAL_SERIAL, LOCAL_ONE| string| `"ANY"`|
| password| Password| The password to use for accessing a secured Cassandra Cluster| string| |
| preparedStatement| Prepared Statement| Whether to use PreparedStatements or regular Statements as the query.| boolean| `true`|
| username| Username| The username to use for accessing a secured Cassandra Cluster| string| |
|===

NOTE: Fields marked with an asterisk ({empty}*) are mandatory.
Expand Down Expand Up @@ -66,9 +67,7 @@ spec:
connectionHost: "localhost"
connectionPort: 9042
keyspace: "customers"
password: "The Password"
preparedStatement: "The Prepared Statement"
username: "The Username"
query: "The Query"
----

Expand All @@ -93,7 +92,7 @@ Configure and run the sink by using the following command:

[source,shell]
----
kamel bind channel:mychannel cassandra-sink -p "sink.connectionHost=localhost" -p sink.connectionPort=9042 -p "sink.keyspace=customers" -p "sink.password=The Password" -p "sink.preparedStatement=The Prepared Statement" -p "sink.username=The Username"
kamel bind channel:mychannel cassandra-sink -p "sink.connectionHost=localhost" -p sink.connectionPort=9042 -p "sink.keyspace=customers" -p "sink.query=The Query"
----

This command creates the KameletBinding in the current namespace on the cluster.
Expand Down Expand Up @@ -124,9 +123,7 @@ spec:
connectionHost: "localhost"
connectionPort: 9042
keyspace: "customers"
password: "The Password"
preparedStatement: "The Prepared Statement"
username: "The Username"
query: "The Query"
----

Expand All @@ -153,7 +150,7 @@ Configure and run the sink by using the following command:

[source,shell]
----
kamel bind kafka.strimzi.io/v1beta1:KafkaTopic:my-topic cassandra-sink -p "sink.connectionHost=localhost" -p sink.connectionPort=9042 -p "sink.keyspace=customers" -p "sink.password=The Password" -p "sink.preparedStatement=The Prepared Statement" -p "sink.username=The Username"
kamel bind kafka.strimzi.io/v1beta1:KafkaTopic:my-topic cassandra-sink -p "sink.connectionHost=localhost" -p sink.connectionPort=9042 -p "sink.keyspace=customers" -p "sink.query=The Query"
----

This command creates the KameletBinding in the current namespace on the cluster.
Expand Down
12 changes: 4 additions & 8 deletions docs/modules/ROOT/pages/cassandra-source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ The following table summarizes the configuration options available for the `cass
| *connectionHost {empty}* *| Connection Host| Hostname(s) cassandra server(s). Multiple hosts can be separated by comma.| string| | `"localhost"`
| *connectionPort {empty}* *| Connection Port| Port number of cassandra server(s)| string| | `9042`
| *keyspace {empty}* *| Keyspace| Keyspace to use| string| | `"customers"`
| *password {empty}* *| Password| The password to use for accessing a secured Cassandra Cluster| string| |
| *query {empty}* *| Query| The query to execute against the Cassandra cluster table| string| |
| *username {empty}* *| Username| The username to use for accessing a secured Cassandra Cluster| string| |
| consistencyLevel| Consistency Level| Consistency level to use. The value can be one of ANY, ONE, TWO, THREE, QUORUM, ALL, LOCAL_QUORUM, EACH_QUORUM, SERIAL, LOCAL_SERIAL, LOCAL_ONE| string| `"ANY"`|
| password| Password| The password to use for accessing a secured Cassandra Cluster| string| |
| resultStrategy| Result Strategy| The strategy to convert the result set of the query. Possible values are ALL, ONE, LIMIT_10, LIMIT_100...| string| `"ALL"`|
| username| Username| The username to use for accessing a secured Cassandra Cluster| string| |
|===

NOTE: Fields marked with an asterisk ({empty}*) are mandatory.
Expand Down Expand Up @@ -60,9 +60,7 @@ spec:
connectionHost: "localhost"
connectionPort: 9042
keyspace: "customers"
password: "The Password"
query: "The Query"
username: "The Username"
sink:
ref:
kind: Channel
Expand Down Expand Up @@ -92,7 +90,7 @@ Configure and run the source by using the following command:

[source,shell]
----
kamel bind cassandra-source -p "source.connectionHost=localhost" -p source.connectionPort=9042 -p "source.keyspace=customers" -p "source.password=The Password" -p "source.query=The Query" -p "source.username=The Username" channel:mychannel
kamel bind cassandra-source -p "source.connectionHost=localhost" -p source.connectionPort=9042 -p "source.keyspace=customers" -p "source.query=The Query" channel:mychannel
----

This command creates the KameletBinding in the current namespace on the cluster.
Expand All @@ -118,9 +116,7 @@ spec:
connectionHost: "localhost"
connectionPort: 9042
keyspace: "customers"
password: "The Password"
query: "The Query"
username: "The Username"
sink:
ref:
kind: KafkaTopic
Expand Down Expand Up @@ -152,7 +148,7 @@ Configure and run the source by using the following command:

[source,shell]
----
kamel bind cassandra-source -p "source.connectionHost=localhost" -p source.connectionPort=9042 -p "source.keyspace=customers" -p "source.password=The Password" -p "source.query=The Query" -p "source.username=The Username" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
kamel bind cassandra-source -p "source.connectionHost=localhost" -p source.connectionPort=9042 -p "source.keyspace=customers" -p "source.query=The Query" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
----

This command creates the KameletBinding in the current namespace on the cluster.
Expand Down
18 changes: 12 additions & 6 deletions kamelets/cassandra-sink.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ spec:
- connectionHost
- connectionPort
- keyspace
- username
- password
- preparedStatement
- query
type: object
properties:
connectionHost:
Expand Down Expand Up @@ -78,7 +76,14 @@ spec:
default: ANY
preparedStatement:
title: Prepared Statement
description: The Prepared statement to execute against the Cassandra cluster table
description: Whether to use PreparedStatements or regular Statements as the query.
type: boolean
default: true
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:checkbox
query:
title: Query
description: The query to execute against the Cassandra cluster table
type: string
types:
in:
Expand All @@ -98,7 +103,8 @@ spec:
- to:
uri: "cql://{{connectionHost}}:{{connectionPort}}/{{keyspace}}"
parameters:
username: "{{username}}"
password: "{{password}}"
username: "{{?username}}"
password: "{{?password}}"
preparedStatement: "{{preparedStatement}}"
consistencyLevel: "{{consistencyLevel}}"
cql: "{{query}}"
6 changes: 2 additions & 4 deletions kamelets/cassandra-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ spec:
- connectionHost
- connectionPort
- keyspace
- username
- password
- query
type: object
properties:
Expand Down Expand Up @@ -94,8 +92,8 @@ spec:
from:
uri: "cql://{{connectionHost}}:{{connectionPort}}/{{keyspace}}"
parameters:
username: "{{username}}"
password: "{{password}}"
username: "{{?username}}"
password: "{{?password}}"
cql: "{{query}}"
consistencyLevel: "{{consistencyLevel}}"
resultSetConversionStrategy: "{{resultStrategy}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ spec:
- connectionHost
- connectionPort
- keyspace
- username
- password
- preparedStatement
- query
type: object
properties:
connectionHost:
Expand Down Expand Up @@ -78,7 +76,12 @@ spec:
default: ANY
preparedStatement:
title: Prepared Statement
description: The Prepared statement to execute against the Cassandra cluster table
description: Whether to use PreparedStatements or regular Statements as the query.
type: boolean
default: true
query:
title: Query
description: The query to execute against the Cassandra cluster table
type: string
types:
in:
Expand All @@ -98,7 +101,8 @@ spec:
- to:
uri: "cql://{{connectionHost}}:{{connectionPort}}/{{keyspace}}"
parameters:
username: "{{username}}"
password: "{{password}}"
username: "{{?username}}"
password: "{{?password}}"
preparedStatement: "{{preparedStatement}}"
consistencyLevel: "{{consistencyLevel}}"
cql: "{{query}}"
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ spec:
- connectionHost
- connectionPort
- keyspace
- username
- password
- query
type: object
properties:
Expand Down Expand Up @@ -94,8 +92,8 @@ spec:
from:
uri: "cql://{{connectionHost}}:{{connectionPort}}/{{keyspace}}"
parameters:
username: "{{username}}"
password: "{{password}}"
username: "{{?username}}"
password: "{{?password}}"
cql: "{{query}}"
consistencyLevel: "{{consistencyLevel}}"
resultSetConversionStrategy: "{{resultStrategy}}"
Expand Down
4 changes: 1 addition & 3 deletions templates/bindings/camel-k/cassandra-sink-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@ spec:
connectionHost: "localhost"
connectionPort: 9042
keyspace: "customers"
password: "The Password"
preparedStatement: "The Prepared Statement"
username: "The Username"
query: "The Query"

2 changes: 0 additions & 2 deletions templates/bindings/camel-k/cassandra-source-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ spec:
connectionHost: "localhost"
connectionPort: 9042
keyspace: "customers"
password: "The Password"
query: "The Query"
username: "The Username"
sink:
ref:
kind: KafkaTopic
Expand Down
4 changes: 1 addition & 3 deletions templates/bindings/core/cassandra-sink-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@
connectionHost: "localhost"
connectionPort: 9042
keyspace: "customers"
password: "The Password"
preparedStatement: "The Prepared Statement"
username: "The Username"
query: "The Query"

2 changes: 0 additions & 2 deletions templates/bindings/core/cassandra-source-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
connectionHost: "localhost"
connectionPort: 9042
keyspace: "customers"
password: "The Password"
query: "The Query"
username: "The Username"
steps:
- to:
uri: "log:info"
Expand Down

0 comments on commit 57cad33

Please sign in to comment.