Module: Sinatra
- Defined in:
- lib/sinatra/queue.rb,
lib/sinatra/jwt_auth.rb,
lib/sinatra/scheduled.rb,
lib/sinatra_opal_patches.rb,
lib/sinatra/cloudflare_workers.rb
Overview
backtick_javascript: true await: true
Phase 11B — Sinatra::Queue
Adds a class-level ‘consume_queue` DSL so user apps can register Cloudflare Queues consumer handlers alongside HTTP routes, matching the Phase 9 `schedule` pattern:
class App < Sinatra::Base
register Sinatra::Queue
consume_queue 'jobs' do |batch|
batch..each do |msg|
body = msg.body # Hash / Array / String
process(body)
msg.ack
end
end
end
The block runs inside a ‘Cloudflare::QueueContext` so it sees the same `db` / `kv` / `bucket` helpers an HTTP route would.
Under the hood, we define the block as a method on QueueContext to pick up Opal’s ‘# await: true` async-transform (same reason `Sinatra::Scheduled` does it — bare `instance_exec` wouldn’t get the ‘__await__` rewrite).
Defined Under Namespace
Modules: CloudflareWorkers, Delegator, Helpers, JwtAuth, Queue, Scheduled Classes: Base, Request, Response