Skip to main content

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 behaviorGoRustTypeScript
Stream APIConsume, Messages() channelconsume, next()consume, messages() async iterator
Handler APIConsumeHandlerconsume_with_handlerconsumeHandler
Fetch batch default101010
Visibility timeout default30 seconds; option zero selects default30 seconds; nonzero integer type30 seconds; option zero selects default
Fallback polling default10 seconds10 seconds1 second
Automatic extensionEnabledEnabledEnabled
Extension threshold0.50.50.5
Handler concurrencyUnlimited unless WithMaxInFlight setExplicit optional limit; None is unlimitedUnlimited unless maxInFlight set
Separately declared queueSupply WithTopicDiscovers topicSupply topic
Success callbackNormal return while live autoacksOk(()) while live autoacksResolved callback while live autoacks
Business failureExplicit nackReturn Err or explicit nackThrow 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โ€‹

BehaviorGoRustTypeScript
Default connection shutdown waitUnboundedUnbounded30 seconds
Finite budget optionWithShutdownTimeoutshutdown_timeoutshutdownTimeoutMs
Supplied pool ownershipCaller closes after connectionCaller closes after connectionCaller closes after connection
Listener resourceOne main-pool connection after first consumeSeparate single-connection poolPooled connection while subscriptions exist
Delivery stop signalHandler context / StoppedCtxstopped() cancellation tokensignal AbortSignal
Queue lossNotifyClose, queue-fatal callbackStream end/error, closed(), queue-fatal callbackonClose, 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.