Repository navigation
feat(spanner): add send_message and ack_message for queues - #260
Closed
torreypayne wants to merge 20 commits into
Closed
torreypayne wants to merge 20 commits into
torreypayne wants to merge 20 commits into
Conversation
…ons in acceptance tests
…strict Option 1 failure behavior
…nitest skip when backend feature is unprovisioned
…ests for direct service testing
… for queue mutations
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_.
This was referenced Oct 12, 2026
Member
Author
|
Split into a five-PR stack for easier review: #261 (deps), #262 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for the Cloud Spanner queue mutations,
SendandAck, which shipped ingoogle-cloud-spanner-v11.12.Commit#send_message(queue, key, payload, send_options: nil)andCommit#ack_message(queue, key, ack_options: nil)add the mutations and return the key.Transactionhas the same methods, so queue writes commit atomically with table writes.SendOptions(deliver_time) orAckOptions(ignore_not_found), or in a hash with the same keys, likecommit_options:.Commit#delete. Payloads are converted like column values, so binary payloads are passed asStringIO.sendbecause that would overrideObject#send.google-cloud-spanner-v1requirement to~> 1.12.The acceptance tests need an Enterprise edition instance and skip on the emulator. They pass against production.
Please squash-merge: earlier commits on the branch use names that were later replaced.