cassandra://
Apache Cassandra / ScyllaDB messaging via github.com/gocql/gocql v1.7.
Pure-Go CQL native protocol. Producer executes CQL with positional or
named binding; polling consumer feeds a route from a SELECT. Covers the portable surface — CQL, consistency, prepare/raw, load-balancing, auth, TLS, datacenter awareness — without JVM beans.
For relational databases use sql:// / postgres://.
For document stores use mongodb://.
URI shape
cassandra://<host1>[,host2,...][:<port>]/<keyspace>?[options]
<host1>,<host2>,... is a CSV of contact-point hosts (port applies to
every host). Default port: 9042. <keyspace> is required.
Parameters
CQL
| Param |
Type |
Default |
Description |
cql |
string |
— |
CQL template. Producer uses it as the default (per-message override via HelixCQLQuery header). Consumer uses it as the polling SELECT (required). |
prepareStatements |
boolean |
true |
Pre-prepare statements on session open. |
resultSetType |
enum |
all |
Producer Out body shape for SELECT-like reads: all = []map[string]any, one = map[string]any, count = int64. |
consistencyLevel |
enum |
QUORUM |
CQL consistency: ANY / ONE / TWO / THREE / QUORUM / ALL / LOCAL_QUORUM / EACH_QUORUM / LOCAL_ONE. |
Cluster
| Param |
Type |
Default |
Description |
datacenter |
string |
datacenter1 |
Local DC for DCAware/TokenAware policies. |
loadBalancingPolicy |
enum |
tokenaware |
roundrobin / tokenaware / dcaware. |
protoVersion |
integer |
0 |
CQL protocol version. 0 = auto-negotiate. |
numConns |
integer |
2 |
Connections per host (gocql NumConns). |
Security
| Param |
Type |
Default |
Description |
username |
string |
— |
gocql PasswordAuthenticator username. |
password |
string |
— |
Password (required when username is set). |
tlsCAFile |
string |
— |
PEM CA bundle. |
tlsCertFile |
string |
— |
PEM client cert (mTLS). |
tlsKeyFile |
string |
— |
PEM client key (mTLS). |
tlsInsecureSkipVerify |
boolean |
false |
Skip server cert verification (insecure, staging only). |
tlsMinVersion |
enum |
— |
TLSv1.0/1.1/1.2/1.3. |
tlsMaxVersion |
enum |
— |
Same. |
Timeouts
| Param |
Type |
Default |
Description |
connectTimeout |
duration |
30s |
gocql Cluster.ConnectTimeout. |
timeout |
duration |
15s |
Per-query timeout. |
reconnectInterval |
duration |
5s |
Delay between reconnect attempts. |
Consumer (polling)
| Param |
Type |
Default |
Description |
delay |
duration |
500ms |
Poll interval. |
initialDelay |
duration |
1s |
Wait before first poll. |
repeatCount |
integer |
0 |
Max poll iterations (0 = infinite). |
| Param |
Type |
Default |
Description |
headerIncludePattern |
string |
— |
Regex — only matching headers pass through. |
headerExcludePattern |
string |
— |
Regex — matching headers are dropped (applied after include). |
Body shapes
The producer accepts these Exchange.In().Body() shapes:
| Body type |
Binding |
nil |
Zero bound parameters. |
[]any |
Positional ? placeholders. |
[]string / []int / []int64 |
Positional (reflected to []any). |
map[string]any |
Named :name placeholders (extracted from the CQL in order). |
| Single scalar (string/int/bool/…) |
Wrapped as a 1-element positional array. |
| Header |
Value |
HelixCQLApplied |
"true" after INSERT/UPDATE/DELETE/DDL. |
HelixCQLRowCount |
uint64 row count (set after SELECT for all/count modes). |
HelixCQLConsistencyLevel |
Consistency string the query used. |
HelixCQLKeyspace |
Keyspace name. |
Examples
Producer + polling consumer
workflows:
- id: write-events
trigger:
uri: timer://heartbeat?period=30s
steps:
- to: cassandra://cluster.prod:9042/events
params:
cql: "INSERT INTO events(id, payload, ts) VALUES (?, ?, toUnixTimestamp(now()))"
- id: read-events
trigger:
uri: cassandra://cluster.prod:9042/events
params:
cql: "SELECT id, payload FROM events"
delay: "5s"
initialDelay: "2s"
steps:
- to: log://stdout?showBody=true
Per-message CQL override
workflows:
- id: dynamic-cql
trigger:
uri: timer://every?period=1m
steps:
- set-header:
name: HelixCQLQuery
constant: "INSERT INTO audit(id, msg) VALUES (uuid(), ?)"
- to: cassandra://h1,h2:9042/audit
TLS + auth
workflows:
- id: prod-write
trigger:
uri: timer://t?period=10s
steps:
- to: cassandra://prod-1,prod-2,prod-3:9042/orders
params:
username: "helix"
password: "${CASSANDRA_PASSWORD}"
tlsCAFile: "/etc/helix/cassandra-ca.pem"
tlsCertFile: "/etc/helix/client.pem"
tlsKeyFile: "/etc/helix/client.key"
consistencyLevel: "LOCAL_QUORUM"
datacenter: "us-east-1"
cql: "INSERT INTO orders(id, amount) VALUES (?, ?)"
See also