Skip to content

feat(spanner): add send_message and ack_message for queues - #1

Closed
torreypayne wants to merge 20 commits into
mainfrom
feature/spanner-queues-draft
Closed

torreypayne wants to merge 20 commits into
mainfrom
feature/spanner-queues-draft

Conversation

@torreypayne

@torreypayne torreypayne commented Aug 4, 2026 •

Copy link
Copy Markdown
Owner

Adds Cloud Spanner Queues support to Commit and Transaction:

  • send_message(queue, key, payload, send_options: nil) appends a Mutation::Send.
  • ack_message(queue, key, ack_options: nil) appends a Mutation::Ack.
  • SendOptions (deliver_time) and AckOptions (ignore_not_found) hold the optional fields. A Hash with the same keys also works, like commit_options:.
  • Requires google-cloud-spanner-v1 1.12, the first release with Send and Ack.
  • Documents queues in OVERVIEW.md and Client.

The acceptance tests create a queue and run against production on an Enterprise edition instance. They skip on the emulator.

Part of b/422251930.

@torreypayne
torreypayne force-pushed the feature/spanner-queues-draft branch from 6995cf0 to c8eb572 Compare August 4, 2026 23:34
…nitest skip when backend feature is unprovisioned
Ruby has no bytes type, and a String's ASCII-8BIT tag doesn't reliably
mean binary data. Drop the inference and reuse the existing column-value
conversion in Convert.object_to_grpc_value: a String is sent as text,
and binary payloads are passed as a StringIO, same as BYTES columns.
…sage

Every Ruby object already has Object#send, so a Commit#send(queue, key, payload) would shadow it. Name the Send mutation method send_message, and the Ack method ack_message to match.
send_message takes send_options: and ack_message takes ack_options:. Each accepts the options object or a Hash with the same keys, like commit_options:. New Send or Ack fields can then be added to the options types without changing the method signatures. Both methods now return the message key, like delete.
Create TestQueue once per run in the per-run test database, then send and ack messages through Client#commit and Client#transaction. The tests check library behaviour only: an ack without ignore_not_found fails unless the message exists, so a successful ack shows the send landed. Queues need an Enterprise edition instance, so the queue DDL stays out of the shared schema, and the tests skip on the emulator.
The queue acceptance tests create this queue. It stays out of schema_ddl_statements because queues need an Enterprise edition instance and the emulator doesn't support them yet.
Mutation::Send and Mutation::Ack first shipped in google-cloud-spanner-v1 1.12.0.
Add a Using queues section to OVERVIEW.md that sends a message, receives messages with the RECEIVE_ function, and acks each one in the same transaction as its write. Add a queues paragraph to the Client overview and a Client#execute_query example that reads from RECEIVE_.
@torreypayne torreypayne changed the title feat(spanner): implement Send and Ack queue mutations and acceptance tests feat(spanner): add send_message and ack_message for queues Oct 5, 2026
@torreypayne

Copy link
Copy Markdown
Owner Author

Superseded by the upstream stack googleapis#261, googleapis#262, googleapis#263, googleapis#264, googleapis#265 (split from googleapis#260). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant