aerospike
Beta
Writes messages to an Aerospike cluster as records, batched and keyed by an interpolated primary key or digest.
Each message is mapped to a single Aerospike record. The record is addressed by
namespace, set, and either key or digest.
key is a user key, which Aerospike hashes. digest is the 20-byte
digest itself and the stored user key is null. The bins are produced by the
bins Bloblang mapping.
Shaping data
This output deliberately has no transform language of its own — use Bloblang, either in a
mapping processor upstream or in the bins field. Aerospike bin names are
capped at 15 characters, so any source field with a longer name must be renamed in the
mapping rather than passed through.
Record model
This output writes whole bins (PutOp). It will not append to a list, increment a
counter, or patch a map in place — those need a modeled operate in application code.
Treat bins as a schema contract the server will not enforce: keep bin names and types
stable, and cap nested lists and maps in Bloblang (this.events.slice(0, 100)). Aerospike
rewrites the entire record on every update, so the bulk of records should stay in
single-digit KiB. Sets are a name, not a shard key. Do not interpolate an unbounded
value. A small fixed list of topic names is fine. Readers address records by primary key, so do
not rely on the data being queryable as a join.
Batching and hot keys
Writes are dispatched with a single batch command per output batch. Configure batching,
otherwise every message is its own command. Aerospike enforces
concurrency limits per record and does not apply the entries of one batch command in order,
so messages for the same key inside one batch are coalesced into one write where that gives
the same result as writing them in order (see coalesce_batch_keys). A message that
cannot be folded is sent in a later batch command, after the earlier one for its key completes.
Coalescing and that ordering apply within a single batch only. max_in_flight
defaults to 1, so batches are written one at a time and writes to one key land in stream
order. A higher value dispatches batches concurrently, so two batches in flight can carry the
same record key, which reorders those two writes and can leave an older value in the record.
Raise it only when keys do not repeat across batches, and prefer larger batches to recover
throughput.
Delivery guarantees
Redpanda Connect delivers at least once, so a message may be written more than once after a retry. Full-record writes are naturally idempotent.
A resolved namespace that is not declared on the cluster is rejected with code 20
(INVALID_NAMESPACE) for that message only. The other messages in the batch are still
written. The rejection does not go away on retry, so with auto_replay_nacks left on,
that message is replayed forever and holds the source partition. Wrap this output in
output.fallback so the rejected message is sent somewhere else instead of being retried.
What this output does not do
Writes are whole-bin puts. Atomic increments, list append, and map operations are not available — shape the record in Bloblang and write the full bin values. There is no input; Aerospike has no client-side change feed.
Performance
This output benefits from sending multiple messages in flight in parallel for improved performance. You can tune the max number of in flight messages (or message batches) with the field max_in_flight.
This output benefits from sending messages as a batch for improved performance. Batches can be formed at both the input and output level. For more information, see Message batching.
-
Common
-
Advanced
output:
label: ""
aerospike:
hosts: [] # No default (required)
namespace: "" # No default (required)
set: ""
key: "" # No default (optional)
digest: "" # No default (optional)
key_type: string
operation: write
tombstone_as_delete: true
bins: root = this
ttl: keep
send_key: false
durable_delete: false
batching:
count: 0
byte_size: 0
period: ""
check: ""
max_in_flight: 1
output:
label: ""
aerospike:
hosts: [] # No default (required)
cluster_name: ""
use_services_alternate: false
connect_timeout: 30s
max_connections_per_node: 100
min_connections_per_node: 0
warm_up: true
max_error_rate: 100
error_rate_window: 1
credentials:
username: ""
password: ""
auth_mode: internal
tls:
enabled: false
skip_cert_verify: false
enable_renegotiation: false
root_cas: ""
root_cas_file: ""
client_certs: []
namespace: "" # No default (required)
set: ""
key: "" # No default (optional)
digest: "" # No default (optional)
key_type: string
key_encoding: utf8
operation: write
tombstone_as_delete: true
bins: root = this
coerce_integral_floats: true
ttl: keep
generation: ""
send_key: false
durable_delete: false
coalesce_batch_keys: true
commit_level: all
max_record_bytes: 0
ignore_error_codes: []
concurrent_nodes: 0
socket_timeout: 5s
total_timeout: 10s
max_retries: 0
batching:
count: 0
byte_size: 0
period: ""
check: ""
processors: [] # No default (optional)
max_in_flight: 1
Fields
auth_mode
Authentication mode. internal is password auth against the server. external is LDAP. pki is client-certificate auth and does not use a password.
Type: string
Default: internal
| Option | Summary |
|---|---|
|
External authentication such as LDAP. Requires TLS. |
|
Hashed password stored on the server. Default. |
|
Certificate authentication. Requires TLS and a client certificate; do not set a password. |
batching
Allows you to configure a batching policy. Without one, every message is written by its own command, one network round trip per message. A good starting point is count: 256 and period: 1s.
Type: object
# Examples:
batching:
byte_size: 5000
count: 0
period: 1s
# ---
batching:
count: 10
period: 1s
# ---
batching:
check: this.contains("END BATCH")
count: 0
period: 1m
batching.byte_size
The maximum total size (in bytes) that a batch can reach before it is flushed. When the combined size of all messages in the batch reaches or exceeds this limit, the batch is immediately sent to the next stage (such as a processor or output).
Set to 0 to disable size-based batching. When disabled, messages are flushed based on other conditions (such as count or period).
Type: int
Default: 0
batching.check
A Bloblang query that returns a boolean value indicating whether a message should end a batch.
Type: string
Default: ""
# Examples:
check: this.type == "end_of_transaction"
batching.count
The number of messages at which the batch is flushed. Set to 0 to disable count-based batching.
Type: int
Default: 0
batching.period
The length of time after which an incomplete batch is flushed regardless of its size. This field accepts Go duration format strings such as 100ms, 1s, or 5s. Supported time units are ns, us, ms, s, m, and h.
Type: string
Default: ""
# Examples:
period: 1s
# ---
period: 1m
# ---
period: 500ms
batching.processors[]
A list of processors to apply to a batch as it is flushed. This allows you to aggregate and archive the batch however you see fit. All resulting messages are flushed as a single batch, so splitting the batch into smaller batches with these processors has no effect.
Type: array<processor>
# Examples:
processors:
- archive:
format: concatenate
# ---
processors:
- archive:
format: lines
# ---
processors:
- archive:
format: json_array
bins
A Bloblang mapping producing an object whose keys are bin names and whose values are bin values. Bin names must be 1-15 characters. Nested objects and arrays become Aerospike maps and lists. Bound collection size here — this output cannot append or trim on the server, and an unbounded list makes every subsequent write rewrite a larger record.
A null value depends on the operation:
-
writeandupdate_onlydelete that bin from the record. -
replaceandreplace_onlyleave that bin out of the write, because those operations already delete bins they do not name. -
A
replaceorreplace_onlywhose every value is null is rejected on that message while the batch is planned, before coalescing, so an earlier write of the same key still lands. That rejection does not clear on retry, andignore_error_codesdoes not cover it, so it holds the source partition until the mapping changes.
When coalescing folds a later message that nulls every bin into an earlier message for the same key, the folded command is a delete:
-
After a
replace, awriteorupdate_onlyproduces the record those messages would leave, and a missing key is already that end state. -
After a
replace_only, anupdate_onlykeeps the existence check, so the delete fails if the record is missing.
Type: string
Default: root = this
# Examples:
bins: root = this.without("user_id")
# ---
bins: |-
root.name = this.full_name
root.email = this.email_address
root.updated = this.updated_at_epoch_seconds
root.events = this.events.slice(0, 50)
cluster_name
Expected cluster name. When set, the client refuses to talk to nodes reporting a different name.
Type: string
Default: ""
coalesce_batch_keys
Collapse multiple messages for the same record key within a batch into a single write. Strongly recommended: sending them separately contends on one record, which surfaces as KEY_BUSY or as latency inflation with no error at all.
Two messages fold only when one command leaves the same record and fails the same messages as writing them in order, whether the key exists or not. Otherwise the later message is sent in a later batch command, after the earlier one completes. Disabling this sends every message on its own, in that order.
-
A
write,replace, ordeletefolds into an earlierwrite,replace, ordelete. After adelete, awritebecomes areplace, so bins the delete removed do not come back. -
An
update_onlyorreplace_onlyfolds into an earlierwriteorreplace, which leaves the record in place, so the existence check is dropped. It also folds into an earlierupdate_onlyorreplace_only, and the folded command keeps the check. -
A
create_onlyfolds only into an earlierdelete, and becomes areplace. -
Nothing folds into a
create_only, and awrite,replace, ordeletedoes not fold into anupdate_onlyorreplace_only, because one command cannot fail one message and apply the other. -
A later
ttlofkeepleaves the expiration of the earlier message, as it would on its own. After adelete, the laterttlapplies, andkeepmeans the namespace default, as for a new record. -
A later
writeorupdate_onlythat nulls every bin of an earlierreplacebecomes adelete, which is the record those messages would leave. After areplace_only, the delete keeps the existence check.
Messages carrying a generation are never coalesced. Coalescing only ever applies within one batch — see max_in_flight for what happens across concurrent batches.
Type: bool
Default: true
coerce_integral_floats
Store JSON numbers with no fractional part as Aerospike integers rather than doubles. JSON has a single number type, so without this an identifier or counter arrives as a double, which breaks integer comparisons, add operations and integer secondary indexes.
The trade-off is that the stored type then depends on the value: a price bin holding 10.0 is written as an integer while 10.5 is written as a double. Aerospike types bins per record rather than per set, so this raises no error, but an integer secondary index over such a bin only indexes the records that happened to be integral. Disable this for bins that are genuinely floating point, or coerce the type explicitly in the bins mapping.
Type: bool
Default: true
commit_level
When the client considers a write successful. all waits for replica copies; master returns after the master copy. Do not use master against a strong-consistency namespace.
Type: string
Default: all
| Option | Summary |
|---|---|
|
Wait until the master and all replicas have committed. Required for strong-consistency namespaces. |
|
Wait only for the master. Faster in AP namespaces when replica lag is acceptable. |
concurrent_nodes
How many cluster nodes to issue batch sub-requests to concurrently. 0 means all of them in parallel. Note this defaults to fanning out where the Aerospike client itself defaults to 1 (one node at a time); combined with max_in_flight it multiplies the load a single pipeline can place on a cluster, so lower it if the cluster is the bottleneck.
Type: int
Default: 0
connect_timeout
Timeout for establishing the initial cluster connection. Capped by the remaining pipeline context deadline when one is set, so a shutdown mid-connect does not wait the full duration.
Type: string
Default: 30s
credentials
Credentials for clusters with access control enabled. Aerospike Community Edition has no authentication; leave empty there.
Type: object
credentials.password
Password for Aerospike access control.
|
This field contains sensitive information that usually shouldn’t be added to a configuration directly. For more information, see Secrets. |
Type: string
Default: ""
digest
The 20-byte record digest as standard Base64, as produced by another Aerospike client. The user key stored with the record is null. Set this or key, not both. key_type and key_encoding apply only to key. namespace and set must be the ones the digest was computed for.
Interpolation always yields a string, so a raw 20-byte digest cannot be told apart from 20 characters of text and is rejected. Encode it in the mapping instead: ${! content().encode("base64") } for a raw payload, or ${! meta("kafka_key").encode("base64") } for a raw Kafka key.
This does not hash the value. key with key_type: bytes hashes those bytes and addresses a different record.
This field supports interpolation functions.
Type: string
# Examples:
digest: ${! json("digest") }
# ---
digest: ${! content().encode("base64") }
# ---
digest: ${! meta("kafka_key").encode("base64") }
durable_delete
Write a tombstone on delete so deleted records cannot reappear after a cold restart. Enterprise Edition only.
Type: bool
Default: false
error_rate_window
Number of cluster tend iterations that make up the window for max_error_rate.
Type: int
Default: 1
generation
Expected record generation for a compare-and-set write. When set, the write fails if the stored generation does not match. Empty disables the check. The value is the generation the producer read the record at.
A compare-and-set message is never coalesced, even with coalesce_batch_keys enabled: the check refers to the specific record that was read, and one command can carry only one expected generation. If several messages in a batch target the same key and any of them carries a generation, each is sent as its own command, one after another in message order. On GENERATION_ERROR the correct recovery is to re-read the record and redo the change, not to retry the same write.
This field supports interpolation functions.
Type: string
Default: ""
# Examples:
generation: ${! meta("aerospike_generation") }
hosts[]
Seed nodes as host, host:port, host:tlsname:port, or [ipv6]:tlsname:port. Port defaults to 3000. The tlsname is the certificate name used for TLS verification and is required against a conventionally secured cluster. The client discovers and connects directly to every node, so all nodes must be reachable from this process — a load balancer in front of the seeds is not sufficient.
Type: array<string>
# Examples:
hosts:
- localhost:3000
# ---
hosts:
- as1.internal:clusterA:3000
# ---
hosts:
- as1.internal:3000
- as2.internal:3000
ignore_error_codes[]
Aerospike result codes to acknowledge instead of failing the message. Empty by default, so a rejection is still a failure and Connect retries it.
A listed code is logged at warning, counted in aerospike_ignored_errors, and then acknowledged. That drops the message: the record is not written, the payload is not kept, and output.fallback does not see it, because this output reported success. Use this for a permanent reject such as 13 (RECORD_TOO_BIG), 20 (INVALID_NAMESPACE), 21 (BIN_NAME_TOO_LONG), or 22 (FAIL_FORBIDDEN), which would otherwise retry forever and hold the source partition.
Code 20 is returned when the resolved namespace is not declared on the cluster. The client marks that record and still writes the other records in the batch. Namespaces cannot be created at runtime. A resolved value of null (a missing interpolated field) is rejected while the batch is planned and is not code 20. When the namespace comes from the message, prefer output.fallback over listing 20: a typo in that field is published instead of dropped.
Code 21 also covers a top-level bin name longer than 15 bytes. That name is rejected while the batch is planned, so the record is never sent and the server does not return 21. A key inside a map or list is not a bin name and is not code 21.
Code 22 is returned when a positive TTL is written to a namespace with nsup-period 0. TTL values 0, -1 (never), and -2 (keep) do not return 22.
Code 2 (KEY_NOT_FOUND) is returned by update_only and replace_only when the record does not exist, and by a delete that coalescing produced from replace_only after every bin was nulled. A plain delete of a missing record does not return it. Listing 2 drops those messages. Prefer output.fallback when a missing key should be sent somewhere else rather than dropped.
With coalesce_batch_keys left on, several messages for one key become one record. A listed code on that record acknowledges every message that folded into it, including messages that would have fit on their own.
A connection failure of the batch is still a failure. So is any mapping error other than that 15-byte name, a result that is in doubt, and any result code left off this list. max_record_bytes is a separate local limit and is not code 13. Codes 0 (OK), 9 (TIMEOUT), 14 (KEY_BUSY), and 18 (DEVICE_OVERLOAD) are rejected, as are other retryable and connection codes. Listing one would drop a record a retry could still write.
Type: array<int>
Default: []
# Examples:
ignore_error_codes:
- 13
- 20
- 21
- 22
key
The record primary key. Set this or digest, not both. Aerospike hashes this value into the record digest; to write a digest the producer already has, use digest.
This field supports interpolation functions.
Type: string
# Examples:
key: ${! json("user_id") }
# ---
key: ${! meta("kafka_key") }
key_encoding
How to decode the interpolated key when key_type is bytes. Interpolation always yields a string, so a genuine binary key must be carried as base64 or hex. utf8 uses the string’s raw bytes and only matches other clients that also stored UTF-8.
Type: string
Default: utf8
Options: utf8, base64, hex
key_type
How to interpret the resolved key. Aerospike addresses records by a digest of the key, and the digest differs between a string "123" and an integer 123. This must match whatever else reads or writes these records.
Type: string
Default: string
Options: string, int, bytes
max_connections_per_node
Maximum size of the client connection pool per cluster node. The client opens connections to every node, so budget max_connections_per_node multiplied by the number of processes against the server’s proto-fd-max.
Type: int
Default: 100
max_error_rate
Errors permitted from a single node per error_rate_window before the client stops sending it commands and fails fast instead. This is a circuit breaker: it stops a pipeline from hammering a node that is already failing. 0 disables it.
Type: int
Default: 100
max_in_flight
Maximum number of batches to have in flight concurrently. The default of 1 writes batches in order, so writes to one key land in stream order. Coalescing and ordering only apply within a batch, so a value above 1 lets two concurrent batches write the same record key out of order and can leave an older value in the record. Raise it only when keys do not repeat across batches.
Type: int
Default: 1
max_record_bytes
Reject a mapped record whose bins exceed this many bytes (approximate). 0 disables the check. Aerospike rewrites the whole record on every update, so treat anything above about 50 KiB as a modeling decision to justify — set a budget here rather than waiting for RECORD_TOO_BIG.
Type: int
Default: 0
max_retries
Client-side retries per batch command. Defaults to 0 because some write operations (create_only, counters) are not idempotent. Raise this only for replace/replace_only/write that you have made safe to repeat.
Type: int
Default: 0
min_connections_per_node
Number of connections per node to keep open even while idle, so a burst after a quiet period does not pay reconnect cost. This is also how many connections warm_up opens. 0 sizes the pool automatically from the concurrency the component can reach, which is what keeps commands from failing while the pool is still filling. Set it explicitly only to override that: every connection is a file descriptor on the node, and with TLS a large pool makes startup and reconnect expensive in server CPU.
Type: int
Default: 0
namespace
The Aerospike namespace. Namespaces are declared in the server config and cannot be created at runtime. A resolved value of null is rejected, because a missing interpolated field stringifies to that. Use meta("kafka_topic") when the topic name is the namespace.
This field supports interpolation functions.
Type: string
# Examples:
namespace: test
# ---
namespace: ${! meta("kafka_topic") }
# ---
namespace: ${! json("namespace_name") }
# ---
namespace: ${! meta("as_namespace") }
operation
The write operation to perform. One of:
-
write— create or update, merging these bins with any existing bins. -
replace— create or replace, deleting existing bins not named here. A null bin is left out of the write. A replace whose every bin is null is rejected on that message. -
replace_only— fail if the record does not exist, otherwise replace, deleting existing bins not named here. A null bin is left out of the write. A replace_only whose every bin is null is rejected on that message. -
create_only— fail if the record already exists. -
update_only— fail if the record does not exist. -
delete— delete the record.
Interpolation allows routing per message, for example from a CDC operation field. For a compact topic or CDC stream that sends the full record each time, use replace so leftover bins cannot accumulate. replace_only on a missing key returns KEY_NOT_FOUND (code 2). That rejection does not go away on retry, so with auto_replay_nacks left on the message is replayed forever and holds the source partition until some other write creates the record. List 2 in ignore_error_codes to drop it, or wrap this output in output.fallback to send it elsewhere. Listing 2 acknowledges the message, so fallback does not see it.
This field supports interpolation functions.
Type: string
Default: write
# Examples:
operation: replace
# ---
operation: ${! if json("op") == "d" { "delete" } else { "write" } }
send_key
Store the primary key alongside the record, so reads can return it. Aerospike stores only a digest by default, meaning the original key is not recoverable from the record.
Type: bool
Default: false
set
The set within the namespace. Sets are created implicitly on first write and cannot be dropped except by truncating. Names are at most 63 bytes and must not contain a colon. A namespace also has a hard cap on how many sets it can hold, so do not interpolate an unbounded value. A small fixed list, such as the topics this pipeline consumes, is fine. A payload field is only safe when the mapping throws for anything outside that list, so a bad value fails before a write can create a set. Leave empty for the null set. The literal null is rejected, because a missing interpolated field stringifies to that and would create a set that cannot be dropped except by truncating.
This field supports interpolation functions.
Type: string
Default: ""
# Examples:
set: users
# ---
set: ${! meta("kafka_topic") }
# ---
set: ${! if ["clicks", "views"].contains(json("set_name")) { json("set_name") } else { throw("set_name is not allowed") } }
# ---
set: ${! meta("as_set") }
socket_timeout
Per-attempt socket timeout for a batch command. Capped by the remaining pipeline context deadline when one is set. A whole batch has to complete within this window, so raise it if batches are large or the cluster is loaded — with max_retries at 0 a socket timeout fails the batch rather than being retried.
Type: string
Default: 5s
tls
Configure Transport Layer Security (TLS) settings to secure network connections. This includes options for standard TLS as well as mutual TLS (mTLS) authentication where both client and server authenticate each other using certificates. Key configuration options include enabled to enable TLS, client_certs for mTLS authentication, root_cas/root_cas_file for custom certificate authorities, and skip_cert_verify for development environments.
Type: object
tls.client_certs[]
A list of client certificates for mutual TLS (mTLS) authentication. Configure this field to enable mTLS, authenticating the client to the server with these certificates.
You must set tls.enabled: true for the client certificates to take effect.
Certificate pairing rules: For each certificate item, provide either:
-
Inline PEM data using both
certandkeyor -
File paths using both
cert_fileandkey_file.
Mixing inline and file-based values within the same item is not supported.
Type: array<object>
Default: []
# Examples:
client_certs:
- cert: foo
key: bar
# ---
client_certs:
- cert_file: ./example.pem
key_file: ./example.key
tls.client_certs[].cert
The plaintext certificate to use for TLS authentication. Must be paired with the corresponding private key in the key field when using inline PEM data for mTLS client certificates.
Type: string
Default: ""
tls.client_certs[].cert_file
The path to a file containing the certificate to use for TLS authentication. Must be paired with the corresponding private key file in the key_file field when using file-based configuration for mTLS client certificates.
Type: string
Default: ""
tls.client_certs[].key
Private key for mTLS client certificate as inline PEM data. Must correspond to the client certificate specified in the cert field. Use this field together with cert when providing certificate data inline rather than through files.
|
This field contains sensitive information that usually shouldn’t be added to a configuration directly. For more information, see Secrets. |
Type: string
Default: ""
tls.client_certs[].key_file
Path to private key file for mTLS client certificate in PEM format. Must correspond to the client certificate specified in the cert_file field. Use this field together with cert_file when loading certificate data from files.
Type: string
Default: ""
tls.client_certs[].password
The password to use for the private key (specified in the key or key_file fields), if it is password-protected. The PKCS#1 and PKCS#8 formats are supported. Supports environment variable interpolation for secure password management.
The pbeWithMD5AndDES-CBC algorithm is obsolete and not supported for the PKCS#8 format. This algorithm does not authenticate the ciphertext, making it vulnerable to padding oracle attacks that can let an attacker recover the plaintext.
|
This field contains sensitive information that usually shouldn’t be added to a configuration directly. For more information, see Secrets. |
Type: string
Default: ""
# Examples:
password: foo
# ---
password: ${KEY_PASSWORD}
tls.enable_renegotiation
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.
Type: bool
Default: false
tls.enabled
Whether to enable TLS for secure connections. Set to true to enable TLS encryption. Required to be true for other TLS options (like client_certs, root_cas, etc.) to take effect.
Type: bool
Default: false
tls.root_cas
Specify a root certificate authority to use (optional). This is a string that represents a certificate chain from the parent-trusted root certificate, through possible intermediate signing certificates, to the host certificate. Use either this field for inline certificate data or root_cas_file for file-based certificate loading.
|
This field contains sensitive information that usually shouldn’t be added to a configuration directly. For more information, see Secrets. |
Type: string
Default: ""
# Examples:
root_cas: |-
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
tls.root_cas_file
Specify the path to a root certificate authority file (optional). This is a file, often with a .pem extension, which contains a certificate chain from the parent-trusted root certificate, through possible intermediate signing certificates, to the host certificate. Use either this field for file-based certificate loading or root_cas for inline certificate data.
Type: string
Default: ""
# Examples:
root_cas_file: ./root_cas.pem
tls.skip_cert_verify
Whether to skip server-side certificate verification. Set to true only for testing environments as this reduces security by disabling certificate validation. When using self-signed certificates or in development, this may be necessary, but should never be used in production. Consider using root_cas or root_cas_file to specify trusted certificates instead of disabling verification entirely.
Type: bool
Default: false
tombstone_as_delete
Treat a message with an empty or null payload as a delete, matching the Kafka tombstone convention. Applied before operation is evaluated. Disable this for HTTP, file, or other sources where an empty body is not a delete.
Type: bool
Default: true
total_timeout
Total timeout for a batch command including retries. Capped by the remaining pipeline context deadline when one is set, so a shutdown cannot wait for the full configured timeout.
Type: string
Default: 10s
ttl
Record time-to-live. Accepts a duration such as 24h, unit spellings (24H, 1D, 5M, 60S, or a bare number of seconds), or:
-
0s/0— use the namespacedefault-ttl. Every write with this value re-bases void-time to that default. -
never/-1— never expire. -
keep/-2— leave the existing expiration untouched on update. On create, the namespace default applies.
Units S/M/H/D are case-insensitive, so a payload such as "ttl": "24H" can be interpolated with ${! json("ttl") } without rewriting producers. Go durations (24h, 90s) still work.
The default is keep so a stream of updates does not reset or shorten void-time. Shortening TTL on an existing record can contribute to resurrection after a cold start. A positive TTL requires nsup-period greater than 0 on the target namespace, otherwise the server rejects the write and nothing ever expires.
This field supports interpolation functions.
Type: string
Default: keep
# Examples:
ttl: 24h
# ---
ttl: 24H
# ---
ttl: never
# ---
ttl: keep
Examples
Stream a topic into Aerospike
Consumes a Redpanda topic and writes each message as a record. A JSON body is keyed by user_id. A tombstone has no body, so the key is the Kafka message key and the record is deleted.
input:
redpanda:
seed_brokers: [ "localhost:19092" ]
topics: [ "users" ]
consumer_group: "aerospike-sink"
output:
aerospike:
hosts: [ "localhost:3000" ]
namespace: test
set: users
key: '${! json("user_id").catch(meta("kafka_key")) }'
bins: 'root = this.without("user_id")'
operation: replace
ttl: keep
batching:
count: 500
period: 1s
Write a record by digest
The producer already has the 20-byte Aerospike digest, carried as a standard Base64 JSON field. The stored user key is null. For a raw 20-byte digest, encode it in the mapping, for example digest: '${! meta("kafka_key").encode("base64") }'.
output:
aerospike:
hosts: [ "localhost:3000" ]
namespace: test
set: users
digest: '${! json("digest") }'
bins: 'root = this.without("digest")'
operation: replace
batching:
count: 256
period: 1s
Route topics to namespaces and sets
One cluster, many namespace and set combinations. The topic name can be the namespace, or a switch can send each topic to a fixed namespace and set. A JSON field can choose the namespace. The set is limited to a known list. The test and payments namespaces must already be declared on the server. Each branch is wrapped in output.fallback so a code 20 (INVALID_NAMESPACE) rejection is not replayed forever.
input:
redpanda:
seed_brokers: [ "localhost:19092" ]
topics: [ "test", "payments", "events" ]
consumer_group: "aerospike-sink"
output:
switch:
cases:
- check: meta("kafka_topic") == "events"
output:
fallback:
- aerospike:
hosts: [ "localhost:3000" ]
namespace: '${! json("namespace_name") }'
set: '${! if ["clicks", "views"].contains(json("set_name")) { json("set_name") } else { throw("set_name is not allowed") } }'
key: '${! json("id") }'
bins: 'root = this.without("id", "namespace_name", "set_name")'
operation: replace
batching:
count: 256
period: 1s
- redpanda:
seed_brokers: [ "localhost:19092" ]
topic: aerospike-rejects
- check: meta("kafka_topic") == "test" || meta("kafka_topic") == "payments"
output:
fallback:
- aerospike:
hosts: [ "localhost:3000" ]
namespace: '${! meta("kafka_topic") }'
set: users
key: '${! meta("kafka_key") }'
bins: 'root = this'
operation: replace
batching:
count: 256
period: 1s
- redpanda:
seed_brokers: [ "localhost:19092" ]
topic: aerospike-rejects