SDK behavior and defaults
This comparison describes Go 0.4.0, Rust 0.4.0, and TypeScript 0.4.0 with SQL 0.1.1, from source commit cbff27b8a34e1384384018680e46c20d5c610cc9. It is a lookup aid; start with Consuming for handler and stream examples.
Consumptionโ
| Setting or behavior | Go | Rust | TypeScript |
|---|---|---|---|
| Stream API | Consume, Messages() channel | consume, next() | consume, messages() async iterator |
| Handler API | ConsumeHandler | consume_with_handler | consumeHandler |
| Fetch batch default | 10 | 10 | 10 |
| Visibility timeout default | 30 seconds; option zero selects default | 30 seconds; nonzero integer type | 30 seconds; option zero selects default |
| Fallback polling default | 10 seconds | 10 seconds | 1 second |
| Automatic extension | Enabled | Enabled | Enabled |
| Extension threshold | 0.5 | 0.5 | 0.5 |
| Handler concurrency | Unlimited unless WithMaxInFlight set | Explicit optional limit; None is unlimited | Unlimited unless maxInFlight set |
| Separately declared queue | Supply WithTopic | Discovers topic | Supply topic |
| Success callback | Normal return while live autoacks | Ok(()) while live autoacks | Resolved callback while live autoacks |
| Business failure | Explicit nack | Return Err or explicit nack | Throw or explicit nack |
Stream consumers share background renewal with handler consumers. They do not automatically acknowledge a completed loop body. Fetch size and callback concurrency are distinct from the total number of claimed deliveries held by the SDK.
Go timeout configuration uses time.Duration for polling/shutdown and integer seconds for VT. Rust uses Duration plus nonzero integer seconds for VT. TypeScript uses milliseconds for polling/shutdown and seconds for VT and queue lifetime. Go retry delay is an absolute time; Rust accepts Duration; TypeScript accepts delay seconds.
TypeScript's autoExtension.extensionSec and autoExtension.maxBatchSize are legacy options not used to govern current renewal. Renewal resets to the consumer visibility timeout; connection-level extenderBatchSize controls statement batch size. Use the documented connection setting rather than assuming those legacy fields change behavior.
Lifetime and ownershipโ
| Behavior | Go | Rust | TypeScript |
|---|---|---|---|
| Default connection shutdown wait | Unbounded | Unbounded | 30 seconds |
| Finite budget option | WithShutdownTimeout | shutdown_timeout | shutdownTimeoutMs |
| Supplied pool ownership | Caller closes after connection | Caller closes after connection | Caller closes after connection |
| Listener resource | One main-pool connection after first consume | Separate single-connection pool | Pooled connection while subscriptions exist |
| Delivery stop signal | Handler context / StoppedCtx | stopped() cancellation token | signal AbortSignal |
| Queue loss | NotifyClose, queue-fatal callback | Stream end/error, closed(), queue-fatal callback | onClose, onQueueFatal |
Choose finite shutdown budgets deliberately. Go and Rust standalone consumer stop can wait without an independent deadline. A connection shutdown timeout does not forcibly terminate application code that ignores cancellation. See Graceful shutdown.
Exclusive queue defaults are a five-minute lifetime and zero/unlimited delivery attempts, as for the SQL declaration. Only the declaring connection manages its lifetime automatically; consumption alone does not maintain it.
Rust dropping an unsettled delivery abandons local tracking rather than acknowledging it. The delivery becomes recoverable through lease expiry. Dropping a consumer requests stop. Do not use drop as proof of completed settlement. Cancelling a settlement future can leave an uncertain database outcome; reconcile through redelivery and idempotency rather than reusing the old delivery.
Retries and transactionsโ
Default database retry budgets use three attempts, 100 ms initial backoff, multiplier 2, and a two-second maximum backoff. Operation eligibility for retry still matters: publishing retries only serialization failure and deadlock, not ambiguous transport errors.
Caller-owned transactional publication and acknowledgement are never internally retried. Commit/rollback and whole-transaction retry belong to the application. Transactional acknowledgement also ends the delivery's normal renewal tracking; finish the transaction promptly. Once transactional acknowledgement has been attempted, retrying through the same delivery object is not supported, even after rollback; an uncommitted delivery must be claimed again after its lease expires.
See SQL errors and the selected native/API references for exact types and errors. Compatibility at connection time checks a schema major; it is not a claim that every additive API exists on every accepted older schema.