# Cassandra

Runs a query against a Cassandra database for each message in order to insert data.

Query arguments can be set using a bloblang array for the fields using the `args_mapping` field.

When populating timestamp columns the value must either be a string in ISO 8601 format (2006-01-02T15:04:05Z07:00), or an integer representing unix time in seconds.

## Configuration

| Name                        | Type                   | Optional | Secret | Description                                                                                                                                                                                                                                      |
| --------------------------- | ---------------------- | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| addresses                   | \[]string              | no       | no     | A list of Cassandra nodes to connect to. Multiple comma separated addresses can be specified on a single line.                                                                                                                                   |
| tls                         | tls                    | no       | no     | Custom TLS settings can be used to override system defaults.                                                                                                                                                                                     |
| password_authenticator      | password_authenticator | no       | no     | Optional configuration of Cassandra authentication parameters.                                                                                                                                                                                   |
| disable_initial_host_lookup | bool                   | yes      | no     | If enabled the driver will not attempt to get host info from the system.peers table. This can speed up queries but will mean that data_centre, rack and token information will not be available. The value defaults to `false`.                  |
| max_retries                 | int                    | yes      | no     | The maximum number of retries before giving up on a request. The value defaults to `3`.                                                                                                                                                          |
| backoff                     | backoff                | no       | no     | Control time intervals between retry attempts.                                                                                                                                                                                                   |
| timeout                     | string                 | yes      | no     | The client connection timeout. The value defaults to `"600ms"`.                                                                                                                                                                                  |
| query                       | string                 | no       | no     | A query to execute for each message.                                                                                                                                                                                                             |
| args_mapping                | string                 | no       | no     | A [Bloblang mapping](/platform/1.14/connectors/bloblang.md) that can be used to provide arguments to Cassandra queries. The result of the query must be an array containing a matching number of elements to the query arguments.                |
| consistency                 | string                 | yes      | no     | The consistency level to use. The value should be one of `ANY`, `ONE`, `TWO`, `THREE`, `QUORUM`, `ALL`, `LOCAL_QUORUM`, `EACH_QUORUM` or `LOCAL_ONE`. The value defaults to `"QUORUM"`.                                                          |
| logged_batch                | bool                   | yes      | no     | If enabled the driver will perform a logged batch. Disabling this prompts unlogged batches to be used instead, which are less efficient but necessary for alternative storages that do not support logged batches. The value defaults to `true`. |
| max_in_flight               | int                    | yes      | no     | The maximum number of messages to have in flight at a given time. Increase this to improve throughput. The value defaults to `64`.                                                                                                               |
| batching                    | batching               | no       | no     | Allows you to configure a batching policy.                                                                                                                                                                                                       |

### TLS configuration

| Name                 | Type            | Optional | Secret | Description                                                                                                                |
| -------------------- | --------------- | -------- | ------ | -------------------------------------------------------------------------------------------------------------------------- |
| enabled              | bool            | yes      | no     | Whether custom TLS settings are enabled. The value defaults to `false`.                                                    |
| skip_cert_verify     | bool            | yes      | no     | Whether to skip server side certificate verification. The value defaults to `false`.                                       |
| enable_renegotiation | bool            | yes      | no     | Whether to allow the remote server to repeatedly request renegotiation.                                                    |
|                      |                 |          |        | Enable this option if you're seeing the error message `local error: tls: no renegotiation`. The value defaults to `false`. |
| root_cas             | string          | yes      | yes    | An optional root certificate authority to use.                                                                             |
|                      |                 |          |        | This is a string, representing a certificate chain from the parent trusted root certificate,                               |
|                      |                 |          |        | to possible intermediate signing certificates, to the host certificate. The value defaults to `""`.                        |
| client_certs         | \[]client_certs | yes      | no     | A list of client certificates to use. . The value defaults to `[]`.                                                        |

### Password_authenticator

| Name     | Type   | Optional | Secret | Description                                                            |
| -------- | ------ | -------- | ------ | ---------------------------------------------------------------------- |
| enabled  | bool   | yes      | no     | Whether to use password authentication. The value defaults to `false`. |
| username | string | yes      | no     | The username to authenticate as. The value defaults to `""`.           |
| password | string | yes      | yes    | The password to authenticate with. The value defaults to `""`.         |

### Backoff

| Name             | Type   | Optional | Secret | Description                                                                      |
| ---------------- | ------ | -------- | ------ | -------------------------------------------------------------------------------- |
| initial_interval | string | yes      | no     | The initial period to wait between retry attempts. The value defaults to `"1s"`. |
| max_interval     | string | yes      | no     | The maximum period to wait between retry attempts. The value defaults to `"5s"`. |

### Batching

| Name      | Type   | Optional | Secret | Description                                                                                                                                                               |
| --------- | ------ | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| count     | int    | yes      | no     | A number of messages at which the batch should be flushed. If `0` disables count based batching. The value defaults to `0`.                                               |
| byte_size | int    | yes      | no     | An amount of bytes at which the batch should be flushed. If `0` disables size based batching. The value defaults to `0`.                                                  |
| period    | string | yes      | no     | A period in which an incomplete batch should be flushed regardless of its size. The value defaults to `""`.                                                               |
| check     | string | yes      | no     | A [Bloblang query](/platform/1.14/connectors/bloblang.md) that should return a boolean value indicating whether a message should end a batch. The value defaults to `""`. |
