Write and verify delivery
For the complete documentation index see: llms.txt
All documentation pages available in markdown.
Write a dispute record to Aerospike to simulate an authorization-service write, then confirm it reaches Elasticsearch over the encrypted pipeline using the same test.disputes set from the get-started tutorial.
-
Write a dispute record and verify delivery through Cross-Datacenter Replication (XDR) over mTLS. The script waits for pending XDR work to finish, captures the cumulative
successcounter, writes the record withaql, and waits for the counter to increase by one.TerminalTerminal write_and_wait_for_xdr() {attempt=1while [ "$attempt" -le 30 ]; dostats="$(docker compose exec -T aerospike asinfo -v 'get-stats:context=xdr;dc=esDC')" || return 1baseline="$(printf '%s\n' "$stats" | tr ';' '\n' | awk -F= '$1 == "success" {print $2}')"in_queue="$(printf '%s\n' "$stats" | tr ';' '\n' | awk -F= '$1 == "in_queue" {print $2}')"in_progress="$(printf '%s\n' "$stats" | tr ';' '\n' | awk -F= '$1 == "in_progress" {print $2}')"case "$baseline" in ''|*[!0-9]*) echo 'Could not read the XDR success counter' >&2; return 1;; esaccase "$in_queue" in ''|*[!0-9]*) echo 'Could not read the XDR queue counter' >&2; return 1;; esaccase "$in_progress" in ''|*[!0-9]*) echo 'Could not read the XDR in-progress counter' >&2; return 1;; esac[ "$in_queue" -eq 0 ] && [ "$in_progress" -eq 0 ] && breakattempt=$((attempt + 1))sleep 1doneif [ "$in_queue" -ne 0 ] || [ "$in_progress" -ne 0 ]; thenecho 'Timed out waiting for pending XDR deliveries' >&2return 1fitarget=$((baseline + 1))docker compose exec -T aerospike-tools \aql -h aerospike -c "INSERT INTO test.disputes (PK, merchant, amount_cents, status, memo) VALUES ('txn-tls-1', 'Orbit Stream Media', 1599, 'open', 'Streaming plan renewal')" || return 1attempt=1while [ "$attempt" -le 30 ]; dostats="$(docker compose exec -T aerospike asinfo -v 'get-stats:context=xdr;dc=esDC')" || return 1success="$(printf '%s\n' "$stats" | tr ';' '\n' | awk -F= '$1 == "success" {print $2}')"case "$success" in ''|*[!0-9]*) echo 'Could not read the XDR success counter' >&2; return 1;; esac[ "$success" -ge "$target" ] && {printf 'baseline=%s target=%s success=%s\n' "$baseline" "$target" "$success"return 0}attempt=$((attempt + 1))sleep 1doneecho 'Timed out waiting for the XDR delivery' >&2printf '%s\n' "$stats" >&2return 1}write_and_wait_for_xdrdelivery_status=$?unset -f write_and_wait_for_xdr[ "$delivery_status" -eq 0 ]Insert and XDR delivery result Expected output OK, 1 record affected.baseline=... target=... success=...The final line confirms that the cumulative XDR
successcounter reached the target for this write. If the command times out, see Troubleshoot. -
Confirm the record reached Elasticsearch over HTTPS. The
-uflag supplies the basic-auth credentials and--cacerttrusts the local CA.TerminalTerminal curl -fsS -X POST --cacert ./security/ca.crt \-u elastic:changeme-for-dev \'https://localhost:9200/aerospike/_refresh' > /dev/nullcurl -fsS --cacert ./security/ca.crt \-u elastic:changeme-for-dev \'https://localhost:9200/aerospike/_count?pretty'Index record count Expected output {"count": 1,"_shards": {"total": 1,"successful": 1,"skipped": 0,"failed": 0}}The matching count confirms the record reached Elasticsearch through both TLS-protected hops.
The dispute you wrote is indexed and reachable only over TLS. You can now run the same search as a support agent.