[{"data":1,"prerenderedAt":2899},["ShallowReactive",2],{"docs:/docs/high-level-sdks/queue":3},{"id":4,"title":5,"body":6,"description":17,"extension":2893,"meta":2894,"navigation":325,"path":2895,"seo":2896,"stem":2897,"__hash__":2898},"docs/docs/high-level-sdks/queue.md","Queue SDK",{"type":7,"value":8,"toc":2878},"minimark",[9,14,18,23,70,75,97,101,144,191,229,255,284,457,461,485,508,512,518,1954,1958,1961,1966,2162,2272,2276,2388,2391,2649,2653,2662,2806,2810,2874],[10,11,13],"h1",{"id":12},"nolagqueue","@nolag/queue",[15,16,17],"p",{},"Real-time job queues with lifecycle tracking, progress updates, and worker management.",[19,20,22],"h2",{"id":21},"overview","Overview",[15,24,25,26,30,31,30,34,37,38,41,42,45,46,48,49,52,53,57,58,61,62,65,66,69],{},"Distribute work across real-time workers with full lifecycle visibility. Jobs follow a state machine: ",[27,28,29],"code",{},"pending",", ",[27,32,33],{},"claimed",[27,35,36],{},"active",", then ",[27,39,40],{},"completed"," or ",[27,43,44],{},"failed",". Every state transition is broadcast to queue participants. A failed job goes back to ",[27,47,29],{}," until ",[27,50,51],{},"maxAttempts"," is exhausted. Three roles participate in a queue: ",[54,55,56],"strong",{},"producers"," add jobs, ",[54,59,60],{},"workers"," claim and process them, and ",[54,63,64],{},"monitors"," observe queue state. A wrapper plays one role; run one wrapper per role. Your app owns one core NoLag client and injects it into ",[27,67,68],{},"NoLagQueue","; the wrapper attaches its behaviour to that connection.",[71,72,74],"h3",{"id":73},"key-features","Key Features",[76,77,78,82,85,88,91,94],"ul",{},[79,80,81],"li",{},"State machine lifecycle: pending, claimed, active, completed, failed",[79,83,84],{},"Load-balanced delivery: each new job reaches exactly one worker in the group",[79,86,87],{},"Priority label on every job and automatic re-queue on failure",[79,89,90],{},"Real-time progress reporting (0-100) broadcast to all participants",[79,92,93],{},"Ephemeral progress channel keeps durable storage lean",[79,95,96],{},"Worker online/offline presence via lobby",[19,98,100],{"id":99},"how-it-works","How It Works",[15,102,103,105,106,109,110,113,114,117,118,121,122,125,126,128,129,132,133,136,137,140,141,143],{},[27,104,68],{}," attaches to an injected ",[27,107,108],{},"@nolag/js-sdk"," client and maintains a lobby for worker presence. Calling ",[27,111,112],{},"joinQueue(name)"," returns a ",[27,115,116],{},"QueueRoom"," that subscribes to two topics: ",[27,119,120],{},"jobs"," for lifecycle events and ",[27,123,124],{},"_progress"," for progress updates. Workers subscribe to ",[27,127,120],{}," with ",[27,130,131],{},"loadBalance: true"," in the group ",[27,134,135],{},"queue-workers-\u003Cqueue>"," (or the ",[27,138,139],{},"loadBalanceGroup"," you set), so the broker hands each job event to exactly one worker in the group. Producers and monitors subscribe without load balancing and see every event. ",[27,142,124],{}," is never load balanced.",[15,145,146,147,150,151,154,155,158,159,161,162,165,166,168,169,172,173,176,177,179,180,183,184,186,187,190],{},"Exclusivity comes from that delivery, not from a server-side claim. ",[27,148,149],{},"claimJob()"," is a local state transition plus a broadcast of ",[27,152,153],{},"jobClaimed",": the worker that received ",[27,156,157],{},"jobAdded"," is the only worker in its group that holds the job, and ",[27,160,149],{}," returns ",[27,163,164],{},"null"," only when the job is unknown locally or is not ",[27,167,29],{},". A retry is immediate: ",[27,170,171],{},"failJob()"," records the attempt, and while ",[27,174,175],{},"attempts \u003C maxAttempts"," it moves the job back to ",[27,178,29],{}," and emits ",[27,181,182],{},"jobRetrying"," in the same call, with no delay or backoff. Nothing re-dispatches the job for you; the worker that failed it claims it again from its ",[27,185,182],{}," handler. ",[27,188,189],{},"priority"," is a label stored on the job and carried in every event; nothing reorders delivery by it. The app owns the socket lifecycle; the wrapper never opens or closes it.",[192,193,194,207],"table",{},[195,196,197],"thead",{},[198,199,200,204],"tr",{},[201,202,203],"th",{},"Topic",[201,205,206],{},"Purpose",[208,209,210,220],"tbody",{},[198,211,212,217],{},[213,214,215],"td",{},[27,216,120],{},[213,218,219],{},"Job lifecycle events: added, claimed, completed, failed, retrying",[198,221,222,226],{},[213,223,224],{},[27,225,124],{},[213,227,228],{},"In-flight progress updates (0-100), not persisted",[15,230,231,232,234,235,41,238,241,242,247,248,30,251,254],{},"Because workers subscribe with ",[27,233,131],{},", a worker group whose actors hold a persistent session (",[27,236,237],{},"agent",[27,239,240],{},"orchestrator",") is the one case where the hosted broker replays what was dispatched while the group was away; see ",[243,244,246],"a",{"href":245},"/docs/concepts/replay","Replay"," for the exact conditions. Replay progress is reported by the core client (",[27,249,250],{},"client.on('replay:start')",[27,252,253],{},"client.on('replay:end')","), not by the wrapper. Producers and monitors never trigger replay.",[256,257,259],"callout",{"type":258},"info",[15,260,261,264,265,268,269,30,272,275,276,279,280,283],{},[54,262,263],{},"Before you start."," Create an app from the ",[27,266,267],{},"nolag-queue-sdk"," blueprint. That seeds the rooms this SDK expects (",[27,270,271],{},"image-processing",[27,273,274],{},"email-dispatch",") and the ",[27,277,278],{},"online"," lobby, and returns an app slug with a random suffix. That slug is the ",[27,281,282],{},"appName"," you pass to the wrapper. You can also do this in the portal: Apps, New App, pick the blueprint.",[285,286,287],"code-tabs",{},[288,289,295],"pre",{"className":290,"code":291,"filename":292,"language":293,"meta":294,"style":294},"language-typescript shiki shiki-themes github-light github-dark","import { NoLagApi } from \"@nolag/js-sdk\";\n\nconst api = new NoLagApi(process.env.NOLAG_API_KEY); // nlg_live_...\nconst app = await api.apps.create({ name: \"My App\", blueprintId: \"nolag-queue-sdk\" });\nconsole.log(app.slug); // e.g. \"my-app-a3f9\": this is your appName\n\nconst actor = await api.actors.create({ name: \"web-client\", actorType: \"user\" });\nconsole.log(actor.accessToken); // shown once; keep it\n","Setup (server side, once)","typescript","",[27,296,297,320,327,360,394,409,414,444],{"__ignoreMap":294},[298,299,302,306,310,313,317],"span",{"class":300,"line":301},"line",1,[298,303,305],{"class":304},"szBVR","import",[298,307,309],{"class":308},"sVt8B"," { NoLagApi } ",[298,311,312],{"class":304},"from",[298,314,316],{"class":315},"sZZnC"," \"@nolag/js-sdk\"",[298,318,319],{"class":308},";\n",[298,321,323],{"class":300,"line":322},2,[298,324,326],{"emptyLinePlaceholder":325},true,"\n",[298,328,330,333,337,340,343,347,350,353,356],{"class":300,"line":329},3,[298,331,332],{"class":304},"const",[298,334,336],{"class":335},"sj4cs"," api",[298,338,339],{"class":304}," =",[298,341,342],{"class":304}," new",[298,344,346],{"class":345},"sScJk"," NoLagApi",[298,348,349],{"class":308},"(process.env.",[298,351,352],{"class":335},"NOLAG_API_KEY",[298,354,355],{"class":308},"); ",[298,357,359],{"class":358},"sJ8bj","// nlg_live_...\n",[298,361,363,365,368,370,373,376,379,382,385,388,391],{"class":300,"line":362},4,[298,364,332],{"class":304},[298,366,367],{"class":335}," app",[298,369,339],{"class":304},[298,371,372],{"class":304}," await",[298,374,375],{"class":308}," api.apps.",[298,377,378],{"class":345},"create",[298,380,381],{"class":308},"({ name: ",[298,383,384],{"class":315},"\"My App\"",[298,386,387],{"class":308},", blueprintId: ",[298,389,390],{"class":315},"\"nolag-queue-sdk\"",[298,392,393],{"class":308}," });\n",[298,395,397,400,403,406],{"class":300,"line":396},5,[298,398,399],{"class":308},"console.",[298,401,402],{"class":345},"log",[298,404,405],{"class":308},"(app.slug); ",[298,407,408],{"class":358},"// e.g. \"my-app-a3f9\": this is your appName\n",[298,410,412],{"class":300,"line":411},6,[298,413,326],{"emptyLinePlaceholder":325},[298,415,417,419,422,424,426,429,431,433,436,439,442],{"class":300,"line":416},7,[298,418,332],{"class":304},[298,420,421],{"class":335}," actor",[298,423,339],{"class":304},[298,425,372],{"class":304},[298,427,428],{"class":308}," api.actors.",[298,430,378],{"class":345},[298,432,381],{"class":308},[298,434,435],{"class":315},"\"web-client\"",[298,437,438],{"class":308},", actorType: ",[298,440,441],{"class":315},"\"user\"",[298,443,393],{"class":308},[298,445,447,449,451,454],{"class":300,"line":446},8,[298,448,399],{"class":308},[298,450,402],{"class":345},[298,452,453],{"class":308},"(actor.accessToken); ",[298,455,456],{"class":358},"// shown once; keep it\n",[19,458,460],{"id":459},"installation","Installation",[285,462,463],{},[288,464,469],{"className":465,"code":466,"filename":467,"language":468,"meta":294,"style":294},"language-bash shiki shiki-themes github-light github-dark","npm install @nolag/queue @nolag/js-sdk\n","Terminal","bash",[27,470,471],{"__ignoreMap":294},[298,472,473,476,479,482],{"class":300,"line":301},[298,474,475],{"class":345},"npm",[298,477,478],{"class":315}," install",[298,480,481],{"class":315}," @nolag/queue",[298,483,484],{"class":315}," @nolag/js-sdk\n",[256,486,487],{"type":258},[15,488,489,492,493,495,496,499,500,503,504,507],{},[54,490,491],{},"Shared connection."," One core NoLag client can back several wrapper SDKs at once, for example a job queue, a dashboard, and notify on a single socket, as long as each wrapper uses a distinct ",[27,494,282],{},". Each wrapper attaches its handlers on construction and releases them with ",[27,497,498],{},"detach()",", and never touches the socket itself. Your app owns ",[27,501,502],{},"connect()"," and ",[27,505,506],{},"disconnect()",".",[19,509,511],{"id":510},"quick-start","Quick Start",[15,513,514,515,517],{},"Each role is its own wrapper, typically its own process. All three join the seeded ",[27,516,271],{}," queue.",[285,519,520,970,1459],{},[288,521,524],{"className":290,"code":522,"filename":523,"language":293,"meta":294,"style":294},"import { NoLag } from '@nolag/js-sdk'\nimport { NoLagQueue } from '@nolag/queue'\n\nconst client = NoLag(PRODUCER_TOKEN)\nconst producer = new NoLagQueue({\n  client,\n  appName: APP_SLUG, // the slug returned when you created the app\n  role: 'producer',\n})\n\nawait client.connect()   // the app owns the connection\nawait producer.ready()   // wrapper setup complete\n\nconst queue = producer.joinQueue('image-processing')\n\n// Enqueue a job. `type` is required; the id is generated for you.\nconst job = queue.addJob({\n  type: 'resize',\n  payload: { imageId: 'img_xyz', width: 1280 },\n  priority: 'high',   // 'low' | 'normal' | 'high' | 'critical'; a label, not an ordering\n  maxAttempts: 3,     // default 3\n})\nconsole.log('Added job:', job.id, 'status:', job.status) // 'pending'\n\n// Producers receive every lifecycle event\nqueue.on('jobCompleted', (done) => console.log(`Job ${done.id} done:`, done.result))\nqueue.on('jobFailed', (failed) => {\n  console.warn(`Job ${failed.id} failed (attempt ${failed.attempts}/${failed.maxAttempts}):`, failed.error)\n})\n\nproducer.detach()\nclient.disconnect()\n","Producer",[27,525,526,538,550,554,575,592,597,610,621,627,632,650,666,671,693,698,704,721,732,750,765,780,785,809,814,820,870,893,937,942,947,959],{"__ignoreMap":294},[298,527,528,530,533,535],{"class":300,"line":301},[298,529,305],{"class":304},[298,531,532],{"class":308}," { NoLag } ",[298,534,312],{"class":304},[298,536,537],{"class":315}," '@nolag/js-sdk'\n",[298,539,540,542,545,547],{"class":300,"line":322},[298,541,305],{"class":304},[298,543,544],{"class":308}," { NoLagQueue } ",[298,546,312],{"class":304},[298,548,549],{"class":315}," '@nolag/queue'\n",[298,551,552],{"class":300,"line":329},[298,553,326],{"emptyLinePlaceholder":325},[298,555,556,558,561,563,566,569,572],{"class":300,"line":362},[298,557,332],{"class":304},[298,559,560],{"class":335}," client",[298,562,339],{"class":304},[298,564,565],{"class":345}," NoLag",[298,567,568],{"class":308},"(",[298,570,571],{"class":335},"PRODUCER_TOKEN",[298,573,574],{"class":308},")\n",[298,576,577,579,582,584,586,589],{"class":300,"line":396},[298,578,332],{"class":304},[298,580,581],{"class":335}," producer",[298,583,339],{"class":304},[298,585,342],{"class":304},[298,587,588],{"class":345}," NoLagQueue",[298,590,591],{"class":308},"({\n",[298,593,594],{"class":300,"line":411},[298,595,596],{"class":308},"  client,\n",[298,598,599,602,605,607],{"class":300,"line":416},[298,600,601],{"class":308},"  appName: ",[298,603,604],{"class":335},"APP_SLUG",[298,606,30],{"class":308},[298,608,609],{"class":358},"// the slug returned when you created the app\n",[298,611,612,615,618],{"class":300,"line":446},[298,613,614],{"class":308},"  role: ",[298,616,617],{"class":315},"'producer'",[298,619,620],{"class":308},",\n",[298,622,624],{"class":300,"line":623},9,[298,625,626],{"class":308},"})\n",[298,628,630],{"class":300,"line":629},10,[298,631,326],{"emptyLinePlaceholder":325},[298,633,635,638,641,644,647],{"class":300,"line":634},11,[298,636,637],{"class":304},"await",[298,639,640],{"class":308}," client.",[298,642,643],{"class":345},"connect",[298,645,646],{"class":308},"()   ",[298,648,649],{"class":358},"// the app owns the connection\n",[298,651,653,655,658,661,663],{"class":300,"line":652},12,[298,654,637],{"class":304},[298,656,657],{"class":308}," producer.",[298,659,660],{"class":345},"ready",[298,662,646],{"class":308},[298,664,665],{"class":358},"// wrapper setup complete\n",[298,667,669],{"class":300,"line":668},13,[298,670,326],{"emptyLinePlaceholder":325},[298,672,674,676,679,681,683,686,688,691],{"class":300,"line":673},14,[298,675,332],{"class":304},[298,677,678],{"class":335}," queue",[298,680,339],{"class":304},[298,682,657],{"class":308},[298,684,685],{"class":345},"joinQueue",[298,687,568],{"class":308},[298,689,690],{"class":315},"'image-processing'",[298,692,574],{"class":308},[298,694,696],{"class":300,"line":695},15,[298,697,326],{"emptyLinePlaceholder":325},[298,699,701],{"class":300,"line":700},16,[298,702,703],{"class":358},"// Enqueue a job. `type` is required; the id is generated for you.\n",[298,705,707,709,712,714,716,719],{"class":300,"line":706},17,[298,708,332],{"class":304},[298,710,711],{"class":335}," job",[298,713,339],{"class":304},[298,715,517],{"class":308},[298,717,718],{"class":345},"addJob",[298,720,591],{"class":308},[298,722,724,727,730],{"class":300,"line":723},18,[298,725,726],{"class":308},"  type: ",[298,728,729],{"class":315},"'resize'",[298,731,620],{"class":308},[298,733,735,738,741,744,747],{"class":300,"line":734},19,[298,736,737],{"class":308},"  payload: { imageId: ",[298,739,740],{"class":315},"'img_xyz'",[298,742,743],{"class":308},", width: ",[298,745,746],{"class":335},"1280",[298,748,749],{"class":308}," },\n",[298,751,753,756,759,762],{"class":300,"line":752},20,[298,754,755],{"class":308},"  priority: ",[298,757,758],{"class":315},"'high'",[298,760,761],{"class":308},",   ",[298,763,764],{"class":358},"// 'low' | 'normal' | 'high' | 'critical'; a label, not an ordering\n",[298,766,768,771,774,777],{"class":300,"line":767},21,[298,769,770],{"class":308},"  maxAttempts: ",[298,772,773],{"class":335},"3",[298,775,776],{"class":308},",     ",[298,778,779],{"class":358},"// default 3\n",[298,781,783],{"class":300,"line":782},22,[298,784,626],{"class":308},[298,786,788,790,792,794,797,800,803,806],{"class":300,"line":787},23,[298,789,399],{"class":308},[298,791,402],{"class":345},[298,793,568],{"class":308},[298,795,796],{"class":315},"'Added job:'",[298,798,799],{"class":308},", job.id, ",[298,801,802],{"class":315},"'status:'",[298,804,805],{"class":308},", job.status) ",[298,807,808],{"class":358},"// 'pending'\n",[298,810,812],{"class":300,"line":811},24,[298,813,326],{"emptyLinePlaceholder":325},[298,815,817],{"class":300,"line":816},25,[298,818,819],{"class":358},"// Producers receive every lifecycle event\n",[298,821,823,826,829,831,834,837,841,844,847,850,852,854,857,859,861,864,867],{"class":300,"line":822},26,[298,824,825],{"class":308},"queue.",[298,827,828],{"class":345},"on",[298,830,568],{"class":308},[298,832,833],{"class":315},"'jobCompleted'",[298,835,836],{"class":308},", (",[298,838,840],{"class":839},"s4XuR","done",[298,842,843],{"class":308},") ",[298,845,846],{"class":304},"=>",[298,848,849],{"class":308}," console.",[298,851,402],{"class":345},[298,853,568],{"class":308},[298,855,856],{"class":315},"`Job ${",[298,858,840],{"class":308},[298,860,507],{"class":315},[298,862,863],{"class":308},"id",[298,865,866],{"class":315},"} done:`",[298,868,869],{"class":308},", done.result))\n",[298,871,873,875,877,879,882,884,886,888,890],{"class":300,"line":872},27,[298,874,825],{"class":308},[298,876,828],{"class":345},[298,878,568],{"class":308},[298,880,881],{"class":315},"'jobFailed'",[298,883,836],{"class":308},[298,885,44],{"class":839},[298,887,843],{"class":308},[298,889,846],{"class":304},[298,891,892],{"class":308}," {\n",[298,894,896,899,902,904,906,908,910,912,915,917,919,922,925,927,929,931,934],{"class":300,"line":895},28,[298,897,898],{"class":308},"  console.",[298,900,901],{"class":345},"warn",[298,903,568],{"class":308},[298,905,856],{"class":315},[298,907,44],{"class":308},[298,909,507],{"class":315},[298,911,863],{"class":308},[298,913,914],{"class":315},"} failed (attempt ${",[298,916,44],{"class":308},[298,918,507],{"class":315},[298,920,921],{"class":308},"attempts",[298,923,924],{"class":315},"}/${",[298,926,44],{"class":308},[298,928,507],{"class":315},[298,930,51],{"class":308},[298,932,933],{"class":315},"}):`",[298,935,936],{"class":308},", failed.error)\n",[298,938,940],{"class":300,"line":939},29,[298,941,626],{"class":308},[298,943,945],{"class":300,"line":944},30,[298,946,326],{"emptyLinePlaceholder":325},[298,948,950,953,956],{"class":300,"line":949},31,[298,951,952],{"class":308},"producer.",[298,954,955],{"class":345},"detach",[298,957,958],{"class":308},"()\n",[298,960,962,965,968],{"class":300,"line":961},32,[298,963,964],{"class":308},"client.",[298,966,967],{"class":345},"disconnect",[298,969,958],{"class":308},[288,971,974],{"className":290,"code":972,"filename":973,"language":293,"meta":294,"style":294},"import { NoLag } from '@nolag/js-sdk'\nimport { NoLagQueue, type Job } from '@nolag/queue'\n\nconst client = NoLag(WORKER_TOKEN)\nconst worker = new NoLagQueue({\n  client,\n  appName: APP_SLUG, // the slug returned when you created the app\n  role: 'worker',\n  concurrency: 4,\n})\n\nawait client.connect()\nawait worker.ready()\n\nconst queue = worker.joinQueue('image-processing')\n\n// Workers subscribe to `jobs` with loadBalance: true, so each new job reaches\n// exactly one worker in the group. claimJob is a local transition plus a\n// broadcast; it returns null if the job is unknown here or not pending.\nasync function process(job: Job) {\n  const claimed = queue.claimJob(job.id)\n  if (!claimed) return\n\n  try {\n    queue.reportProgress(job.id, 25)\n    const outputUrl = await doExpensiveWork(job.payload)\n    queue.reportProgress(job.id, 100)\n    queue.completeJob(job.id, { outputUrl })\n  } catch (err) {\n    // Retry is immediate: while attempts \u003C maxAttempts the job goes back to\n    // pending and jobRetrying fires on this worker, which claims it again.\n    queue.failJob(job.id, err instanceof Error ? err.message : String(err))\n  }\n}\n\nqueue.on('jobAdded', process)\nqueue.on('jobRetrying', (job) => {\n  console.log(`Retrying job ${job.id} (attempt ${job.attempts + 1}/${job.maxAttempts})`)\n  process(job)\n})\n\nworker.detach()\nclient.disconnect()\n","Worker",[27,975,976,986,1003,1007,1024,1039,1043,1053,1062,1072,1076,1080,1090,1101,1105,1123,1127,1132,1137,1142,1167,1185,1202,1206,1213,1229,1247,1260,1270,1281,1286,1291,1321,1327,1333,1338,1353,1375,1421,1430,1435,1440,1450],{"__ignoreMap":294},[298,977,978,980,982,984],{"class":300,"line":301},[298,979,305],{"class":304},[298,981,532],{"class":308},[298,983,312],{"class":304},[298,985,537],{"class":315},[298,987,988,990,993,996,999,1001],{"class":300,"line":322},[298,989,305],{"class":304},[298,991,992],{"class":308}," { NoLagQueue, ",[298,994,995],{"class":304},"type",[298,997,998],{"class":308}," Job } ",[298,1000,312],{"class":304},[298,1002,549],{"class":315},[298,1004,1005],{"class":300,"line":329},[298,1006,326],{"emptyLinePlaceholder":325},[298,1008,1009,1011,1013,1015,1017,1019,1022],{"class":300,"line":362},[298,1010,332],{"class":304},[298,1012,560],{"class":335},[298,1014,339],{"class":304},[298,1016,565],{"class":345},[298,1018,568],{"class":308},[298,1020,1021],{"class":335},"WORKER_TOKEN",[298,1023,574],{"class":308},[298,1025,1026,1028,1031,1033,1035,1037],{"class":300,"line":396},[298,1027,332],{"class":304},[298,1029,1030],{"class":335}," worker",[298,1032,339],{"class":304},[298,1034,342],{"class":304},[298,1036,588],{"class":345},[298,1038,591],{"class":308},[298,1040,1041],{"class":300,"line":411},[298,1042,596],{"class":308},[298,1044,1045,1047,1049,1051],{"class":300,"line":416},[298,1046,601],{"class":308},[298,1048,604],{"class":335},[298,1050,30],{"class":308},[298,1052,609],{"class":358},[298,1054,1055,1057,1060],{"class":300,"line":446},[298,1056,614],{"class":308},[298,1058,1059],{"class":315},"'worker'",[298,1061,620],{"class":308},[298,1063,1064,1067,1070],{"class":300,"line":623},[298,1065,1066],{"class":308},"  concurrency: ",[298,1068,1069],{"class":335},"4",[298,1071,620],{"class":308},[298,1073,1074],{"class":300,"line":629},[298,1075,626],{"class":308},[298,1077,1078],{"class":300,"line":634},[298,1079,326],{"emptyLinePlaceholder":325},[298,1081,1082,1084,1086,1088],{"class":300,"line":652},[298,1083,637],{"class":304},[298,1085,640],{"class":308},[298,1087,643],{"class":345},[298,1089,958],{"class":308},[298,1091,1092,1094,1097,1099],{"class":300,"line":668},[298,1093,637],{"class":304},[298,1095,1096],{"class":308}," worker.",[298,1098,660],{"class":345},[298,1100,958],{"class":308},[298,1102,1103],{"class":300,"line":673},[298,1104,326],{"emptyLinePlaceholder":325},[298,1106,1107,1109,1111,1113,1115,1117,1119,1121],{"class":300,"line":695},[298,1108,332],{"class":304},[298,1110,678],{"class":335},[298,1112,339],{"class":304},[298,1114,1096],{"class":308},[298,1116,685],{"class":345},[298,1118,568],{"class":308},[298,1120,690],{"class":315},[298,1122,574],{"class":308},[298,1124,1125],{"class":300,"line":700},[298,1126,326],{"emptyLinePlaceholder":325},[298,1128,1129],{"class":300,"line":706},[298,1130,1131],{"class":358},"// Workers subscribe to `jobs` with loadBalance: true, so each new job reaches\n",[298,1133,1134],{"class":300,"line":723},[298,1135,1136],{"class":358},"// exactly one worker in the group. claimJob is a local transition plus a\n",[298,1138,1139],{"class":300,"line":734},[298,1140,1141],{"class":358},"// broadcast; it returns null if the job is unknown here or not pending.\n",[298,1143,1144,1147,1150,1153,1155,1158,1161,1164],{"class":300,"line":752},[298,1145,1146],{"class":304},"async",[298,1148,1149],{"class":304}," function",[298,1151,1152],{"class":345}," process",[298,1154,568],{"class":308},[298,1156,1157],{"class":839},"job",[298,1159,1160],{"class":304},":",[298,1162,1163],{"class":345}," Job",[298,1165,1166],{"class":308},") {\n",[298,1168,1169,1172,1175,1177,1179,1182],{"class":300,"line":767},[298,1170,1171],{"class":304},"  const",[298,1173,1174],{"class":335}," claimed",[298,1176,339],{"class":304},[298,1178,517],{"class":308},[298,1180,1181],{"class":345},"claimJob",[298,1183,1184],{"class":308},"(job.id)\n",[298,1186,1187,1190,1193,1196,1199],{"class":300,"line":782},[298,1188,1189],{"class":304},"  if",[298,1191,1192],{"class":308}," (",[298,1194,1195],{"class":304},"!",[298,1197,1198],{"class":308},"claimed) ",[298,1200,1201],{"class":304},"return\n",[298,1203,1204],{"class":300,"line":787},[298,1205,326],{"emptyLinePlaceholder":325},[298,1207,1208,1211],{"class":300,"line":811},[298,1209,1210],{"class":304},"  try",[298,1212,892],{"class":308},[298,1214,1215,1218,1221,1224,1227],{"class":300,"line":816},[298,1216,1217],{"class":308},"    queue.",[298,1219,1220],{"class":345},"reportProgress",[298,1222,1223],{"class":308},"(job.id, ",[298,1225,1226],{"class":335},"25",[298,1228,574],{"class":308},[298,1230,1231,1234,1237,1239,1241,1244],{"class":300,"line":822},[298,1232,1233],{"class":304},"    const",[298,1235,1236],{"class":335}," outputUrl",[298,1238,339],{"class":304},[298,1240,372],{"class":304},[298,1242,1243],{"class":345}," doExpensiveWork",[298,1245,1246],{"class":308},"(job.payload)\n",[298,1248,1249,1251,1253,1255,1258],{"class":300,"line":872},[298,1250,1217],{"class":308},[298,1252,1220],{"class":345},[298,1254,1223],{"class":308},[298,1256,1257],{"class":335},"100",[298,1259,574],{"class":308},[298,1261,1262,1264,1267],{"class":300,"line":895},[298,1263,1217],{"class":308},[298,1265,1266],{"class":345},"completeJob",[298,1268,1269],{"class":308},"(job.id, { outputUrl })\n",[298,1271,1272,1275,1278],{"class":300,"line":939},[298,1273,1274],{"class":308},"  } ",[298,1276,1277],{"class":304},"catch",[298,1279,1280],{"class":308}," (err) {\n",[298,1282,1283],{"class":300,"line":944},[298,1284,1285],{"class":358},"    // Retry is immediate: while attempts \u003C maxAttempts the job goes back to\n",[298,1287,1288],{"class":300,"line":949},[298,1289,1290],{"class":358},"    // pending and jobRetrying fires on this worker, which claims it again.\n",[298,1292,1293,1295,1298,1301,1304,1307,1310,1313,1315,1318],{"class":300,"line":961},[298,1294,1217],{"class":308},[298,1296,1297],{"class":345},"failJob",[298,1299,1300],{"class":308},"(job.id, err ",[298,1302,1303],{"class":304},"instanceof",[298,1305,1306],{"class":345}," Error",[298,1308,1309],{"class":304}," ?",[298,1311,1312],{"class":308}," err.message ",[298,1314,1160],{"class":304},[298,1316,1317],{"class":345}," String",[298,1319,1320],{"class":308},"(err))\n",[298,1322,1324],{"class":300,"line":1323},33,[298,1325,1326],{"class":308},"  }\n",[298,1328,1330],{"class":300,"line":1329},34,[298,1331,1332],{"class":308},"}\n",[298,1334,1336],{"class":300,"line":1335},35,[298,1337,326],{"emptyLinePlaceholder":325},[298,1339,1341,1343,1345,1347,1350],{"class":300,"line":1340},36,[298,1342,825],{"class":308},[298,1344,828],{"class":345},[298,1346,568],{"class":308},[298,1348,1349],{"class":315},"'jobAdded'",[298,1351,1352],{"class":308},", process)\n",[298,1354,1356,1358,1360,1362,1365,1367,1369,1371,1373],{"class":300,"line":1355},37,[298,1357,825],{"class":308},[298,1359,828],{"class":345},[298,1361,568],{"class":308},[298,1363,1364],{"class":315},"'jobRetrying'",[298,1366,836],{"class":308},[298,1368,1157],{"class":839},[298,1370,843],{"class":308},[298,1372,846],{"class":304},[298,1374,892],{"class":308},[298,1376,1378,1380,1382,1384,1387,1389,1391,1393,1396,1398,1400,1402,1405,1408,1410,1412,1414,1416,1419],{"class":300,"line":1377},38,[298,1379,898],{"class":308},[298,1381,402],{"class":345},[298,1383,568],{"class":308},[298,1385,1386],{"class":315},"`Retrying job ${",[298,1388,1157],{"class":308},[298,1390,507],{"class":315},[298,1392,863],{"class":308},[298,1394,1395],{"class":315},"} (attempt ${",[298,1397,1157],{"class":308},[298,1399,507],{"class":315},[298,1401,921],{"class":308},[298,1403,1404],{"class":304}," +",[298,1406,1407],{"class":335}," 1",[298,1409,924],{"class":315},[298,1411,1157],{"class":308},[298,1413,507],{"class":315},[298,1415,51],{"class":308},[298,1417,1418],{"class":315},"})`",[298,1420,574],{"class":308},[298,1422,1424,1427],{"class":300,"line":1423},39,[298,1425,1426],{"class":345},"  process",[298,1428,1429],{"class":308},"(job)\n",[298,1431,1433],{"class":300,"line":1432},40,[298,1434,626],{"class":308},[298,1436,1438],{"class":300,"line":1437},41,[298,1439,326],{"emptyLinePlaceholder":325},[298,1441,1443,1446,1448],{"class":300,"line":1442},42,[298,1444,1445],{"class":308},"worker.",[298,1447,955],{"class":345},[298,1449,958],{"class":308},[298,1451,1453,1455,1457],{"class":300,"line":1452},43,[298,1454,964],{"class":308},[298,1456,967],{"class":345},[298,1458,958],{"class":308},[288,1460,1463],{"className":290,"code":1461,"filename":1462,"language":293,"meta":294,"style":294},"import { NoLag } from '@nolag/js-sdk'\nimport { NoLagQueue } from '@nolag/queue'\n\nconst client = NoLag(MONITOR_TOKEN)\nconst monitor = new NoLagQueue({\n  client,\n  appName: APP_SLUG, // the slug returned when you created the app\n  role: 'monitor',   // the default\n})\n\nawait client.connect()\nawait monitor.ready()\n\nconst queue = monitor.joinQueue('image-processing')\n\nqueue.on('jobProgress', ({ jobId, progress, workerId }) => {\n  console.log(`Job ${jobId} is ${progress}% complete on ${workerId}`)\n})\n\nqueue.on('jobClaimed', (job) => console.log(`Job ${job.id} claimed by ${job.claimedBy}`))\nqueue.on('jobCompleted', (job) => console.log(`Job ${job.id} done:`, job.result))\nqueue.on('jobFailed', (job) => console.warn(`Job ${job.id} failed:`, job.error))\n\n// Queue depth from the local cache (plain getters). A monitor only knows about\n// jobs whose events it has received since joining.\nconsole.log('Pending:', queue.pendingCount)\nconsole.log('Active:', queue.activeCount)\nconsole.log('Failed:', queue.getJobs({ status: 'failed' }).length)\n\nmonitor.on('workerOnline', (w) => console.log('Worker online:', w.workerId))\nmonitor.on('workerOffline', (w) => console.log('Worker offline:', w.workerId))\n\nmonitor.detach()\nclient.disconnect()\n","Monitor",[27,1464,1465,1475,1485,1489,1506,1521,1525,1535,1547,1551,1555,1565,1576,1580,1598,1602,1636,1663,1667,1671,1719,1756,1794,1798,1803,1808,1822,1836,1867,1871,1904,1934,1938,1946],{"__ignoreMap":294},[298,1466,1467,1469,1471,1473],{"class":300,"line":301},[298,1468,305],{"class":304},[298,1470,532],{"class":308},[298,1472,312],{"class":304},[298,1474,537],{"class":315},[298,1476,1477,1479,1481,1483],{"class":300,"line":322},[298,1478,305],{"class":304},[298,1480,544],{"class":308},[298,1482,312],{"class":304},[298,1484,549],{"class":315},[298,1486,1487],{"class":300,"line":329},[298,1488,326],{"emptyLinePlaceholder":325},[298,1490,1491,1493,1495,1497,1499,1501,1504],{"class":300,"line":362},[298,1492,332],{"class":304},[298,1494,560],{"class":335},[298,1496,339],{"class":304},[298,1498,565],{"class":345},[298,1500,568],{"class":308},[298,1502,1503],{"class":335},"MONITOR_TOKEN",[298,1505,574],{"class":308},[298,1507,1508,1510,1513,1515,1517,1519],{"class":300,"line":396},[298,1509,332],{"class":304},[298,1511,1512],{"class":335}," monitor",[298,1514,339],{"class":304},[298,1516,342],{"class":304},[298,1518,588],{"class":345},[298,1520,591],{"class":308},[298,1522,1523],{"class":300,"line":411},[298,1524,596],{"class":308},[298,1526,1527,1529,1531,1533],{"class":300,"line":416},[298,1528,601],{"class":308},[298,1530,604],{"class":335},[298,1532,30],{"class":308},[298,1534,609],{"class":358},[298,1536,1537,1539,1542,1544],{"class":300,"line":446},[298,1538,614],{"class":308},[298,1540,1541],{"class":315},"'monitor'",[298,1543,761],{"class":308},[298,1545,1546],{"class":358},"// the default\n",[298,1548,1549],{"class":300,"line":623},[298,1550,626],{"class":308},[298,1552,1553],{"class":300,"line":629},[298,1554,326],{"emptyLinePlaceholder":325},[298,1556,1557,1559,1561,1563],{"class":300,"line":634},[298,1558,637],{"class":304},[298,1560,640],{"class":308},[298,1562,643],{"class":345},[298,1564,958],{"class":308},[298,1566,1567,1569,1572,1574],{"class":300,"line":652},[298,1568,637],{"class":304},[298,1570,1571],{"class":308}," monitor.",[298,1573,660],{"class":345},[298,1575,958],{"class":308},[298,1577,1578],{"class":300,"line":668},[298,1579,326],{"emptyLinePlaceholder":325},[298,1581,1582,1584,1586,1588,1590,1592,1594,1596],{"class":300,"line":673},[298,1583,332],{"class":304},[298,1585,678],{"class":335},[298,1587,339],{"class":304},[298,1589,1571],{"class":308},[298,1591,685],{"class":345},[298,1593,568],{"class":308},[298,1595,690],{"class":315},[298,1597,574],{"class":308},[298,1599,1600],{"class":300,"line":695},[298,1601,326],{"emptyLinePlaceholder":325},[298,1603,1604,1606,1608,1610,1613,1616,1619,1621,1624,1626,1629,1632,1634],{"class":300,"line":700},[298,1605,825],{"class":308},[298,1607,828],{"class":345},[298,1609,568],{"class":308},[298,1611,1612],{"class":315},"'jobProgress'",[298,1614,1615],{"class":308},", ({ ",[298,1617,1618],{"class":839},"jobId",[298,1620,30],{"class":308},[298,1622,1623],{"class":839},"progress",[298,1625,30],{"class":308},[298,1627,1628],{"class":839},"workerId",[298,1630,1631],{"class":308}," }) ",[298,1633,846],{"class":304},[298,1635,892],{"class":308},[298,1637,1638,1640,1642,1644,1646,1648,1651,1653,1656,1658,1661],{"class":300,"line":706},[298,1639,898],{"class":308},[298,1641,402],{"class":345},[298,1643,568],{"class":308},[298,1645,856],{"class":315},[298,1647,1618],{"class":308},[298,1649,1650],{"class":315},"} is ${",[298,1652,1623],{"class":308},[298,1654,1655],{"class":315},"}% complete on ${",[298,1657,1628],{"class":308},[298,1659,1660],{"class":315},"}`",[298,1662,574],{"class":308},[298,1664,1665],{"class":300,"line":723},[298,1666,626],{"class":308},[298,1668,1669],{"class":300,"line":734},[298,1670,326],{"emptyLinePlaceholder":325},[298,1672,1673,1675,1677,1679,1682,1684,1686,1688,1690,1692,1694,1696,1698,1700,1702,1704,1707,1709,1711,1714,1716],{"class":300,"line":752},[298,1674,825],{"class":308},[298,1676,828],{"class":345},[298,1678,568],{"class":308},[298,1680,1681],{"class":315},"'jobClaimed'",[298,1683,836],{"class":308},[298,1685,1157],{"class":839},[298,1687,843],{"class":308},[298,1689,846],{"class":304},[298,1691,849],{"class":308},[298,1693,402],{"class":345},[298,1695,568],{"class":308},[298,1697,856],{"class":315},[298,1699,1157],{"class":308},[298,1701,507],{"class":315},[298,1703,863],{"class":308},[298,1705,1706],{"class":315},"} claimed by ${",[298,1708,1157],{"class":308},[298,1710,507],{"class":315},[298,1712,1713],{"class":308},"claimedBy",[298,1715,1660],{"class":315},[298,1717,1718],{"class":308},"))\n",[298,1720,1721,1723,1725,1727,1729,1731,1733,1735,1737,1739,1741,1743,1745,1747,1749,1751,1753],{"class":300,"line":767},[298,1722,825],{"class":308},[298,1724,828],{"class":345},[298,1726,568],{"class":308},[298,1728,833],{"class":315},[298,1730,836],{"class":308},[298,1732,1157],{"class":839},[298,1734,843],{"class":308},[298,1736,846],{"class":304},[298,1738,849],{"class":308},[298,1740,402],{"class":345},[298,1742,568],{"class":308},[298,1744,856],{"class":315},[298,1746,1157],{"class":308},[298,1748,507],{"class":315},[298,1750,863],{"class":308},[298,1752,866],{"class":315},[298,1754,1755],{"class":308},", job.result))\n",[298,1757,1758,1760,1762,1764,1766,1768,1770,1772,1774,1776,1778,1780,1782,1784,1786,1788,1791],{"class":300,"line":782},[298,1759,825],{"class":308},[298,1761,828],{"class":345},[298,1763,568],{"class":308},[298,1765,881],{"class":315},[298,1767,836],{"class":308},[298,1769,1157],{"class":839},[298,1771,843],{"class":308},[298,1773,846],{"class":304},[298,1775,849],{"class":308},[298,1777,901],{"class":345},[298,1779,568],{"class":308},[298,1781,856],{"class":315},[298,1783,1157],{"class":308},[298,1785,507],{"class":315},[298,1787,863],{"class":308},[298,1789,1790],{"class":315},"} failed:`",[298,1792,1793],{"class":308},", job.error))\n",[298,1795,1796],{"class":300,"line":787},[298,1797,326],{"emptyLinePlaceholder":325},[298,1799,1800],{"class":300,"line":811},[298,1801,1802],{"class":358},"// Queue depth from the local cache (plain getters). A monitor only knows about\n",[298,1804,1805],{"class":300,"line":816},[298,1806,1807],{"class":358},"// jobs whose events it has received since joining.\n",[298,1809,1810,1812,1814,1816,1819],{"class":300,"line":822},[298,1811,399],{"class":308},[298,1813,402],{"class":345},[298,1815,568],{"class":308},[298,1817,1818],{"class":315},"'Pending:'",[298,1820,1821],{"class":308},", queue.pendingCount)\n",[298,1823,1824,1826,1828,1830,1833],{"class":300,"line":872},[298,1825,399],{"class":308},[298,1827,402],{"class":345},[298,1829,568],{"class":308},[298,1831,1832],{"class":315},"'Active:'",[298,1834,1835],{"class":308},", queue.activeCount)\n",[298,1837,1838,1840,1842,1844,1847,1850,1853,1856,1859,1862,1865],{"class":300,"line":895},[298,1839,399],{"class":308},[298,1841,402],{"class":345},[298,1843,568],{"class":308},[298,1845,1846],{"class":315},"'Failed:'",[298,1848,1849],{"class":308},", queue.",[298,1851,1852],{"class":345},"getJobs",[298,1854,1855],{"class":308},"({ status: ",[298,1857,1858],{"class":315},"'failed'",[298,1860,1861],{"class":308}," }).",[298,1863,1864],{"class":335},"length",[298,1866,574],{"class":308},[298,1868,1869],{"class":300,"line":939},[298,1870,326],{"emptyLinePlaceholder":325},[298,1872,1873,1876,1878,1880,1883,1885,1888,1890,1892,1894,1896,1898,1901],{"class":300,"line":944},[298,1874,1875],{"class":308},"monitor.",[298,1877,828],{"class":345},[298,1879,568],{"class":308},[298,1881,1882],{"class":315},"'workerOnline'",[298,1884,836],{"class":308},[298,1886,1887],{"class":839},"w",[298,1889,843],{"class":308},[298,1891,846],{"class":304},[298,1893,849],{"class":308},[298,1895,402],{"class":345},[298,1897,568],{"class":308},[298,1899,1900],{"class":315},"'Worker online:'",[298,1902,1903],{"class":308},", w.workerId))\n",[298,1905,1906,1908,1910,1912,1915,1917,1919,1921,1923,1925,1927,1929,1932],{"class":300,"line":949},[298,1907,1875],{"class":308},[298,1909,828],{"class":345},[298,1911,568],{"class":308},[298,1913,1914],{"class":315},"'workerOffline'",[298,1916,836],{"class":308},[298,1918,1887],{"class":839},[298,1920,843],{"class":308},[298,1922,846],{"class":304},[298,1924,849],{"class":308},[298,1926,402],{"class":345},[298,1928,568],{"class":308},[298,1930,1931],{"class":315},"'Worker offline:'",[298,1933,1903],{"class":308},[298,1935,1936],{"class":300,"line":961},[298,1937,326],{"emptyLinePlaceholder":325},[298,1939,1940,1942,1944],{"class":300,"line":1323},[298,1941,1875],{"class":308},[298,1943,955],{"class":345},[298,1945,958],{"class":308},[298,1947,1948,1950,1952],{"class":300,"line":1329},[298,1949,964],{"class":308},[298,1951,967],{"class":345},[298,1953,958],{"class":308},[19,1955,1957],{"id":1956},"api-reference","API Reference",[71,1959,68],{"id":1960},"nolagqueue-1",[1962,1963,1965],"h4",{"id":1964},"constructor-options","Constructor Options",[192,1967,1968,1981],{},[195,1969,1970],{},[198,1971,1972,1975,1978],{},[201,1973,1974],{},"Option",[201,1976,1977],{},"Type",[201,1979,1980],{},"Description",[208,1982,1983,2001,2019,2038,2056,2079,2094,2109,2126,2144],{},[198,1984,1985,1990,1995],{},[213,1986,1987],{},[27,1988,1989],{},"client",[213,1991,1992],{},[27,1993,1994],{},"NoLagSocket",[213,1996,1997,2000],{},[54,1998,1999],{},"Required."," The injected core NoLag client the app owns and connects.",[198,2002,2003,2007,2012],{},[213,2004,2005],{},[27,2006,282],{},[213,2008,2009],{},[27,2010,2011],{},"string",[213,2013,2014,2015,2018],{},"The app slug used as the topic prefix. Pass the suffixed slug returned when you created the app; the default ",[27,2016,2017],{},"'queue'"," will not match a hosted app.",[198,2020,2021,2025,2029],{},[213,2022,2023],{},[27,2024,1628],{},[213,2026,2027],{},[27,2028,2011],{},[213,2030,2031,2032,503,2035,2037],{},"Stable worker ID for this client (auto-generated if omitted). Recorded as ",[27,2033,2034],{},"createdBy",[27,2036,1713],{}," on jobs.",[198,2039,2040,2045,2050],{},[213,2041,2042],{},[27,2043,2044],{},"role",[213,2046,2047],{},[27,2048,2049],{},"'producer' | 'worker' | 'monitor'",[213,2051,2052,2053,2055],{},"Role this wrapper plays (default ",[27,2054,1541],{},"). Only workers subscribe with load balancing.",[198,2057,2058,2063,2068],{},[213,2059,2060],{},[27,2061,2062],{},"concurrency",[213,2064,2065],{},[27,2066,2067],{},"number",[213,2069,2070,2071,2074,2075,2078],{},"Advertised in worker presence as ",[27,2072,2073],{},"QueueWorker.concurrency"," (default ",[27,2076,2077],{},"1","). The wrapper does not limit claims by it.",[198,2080,2081,2086,2091],{},[213,2082,2083],{},[27,2084,2085],{},"metadata",[213,2087,2088],{},[27,2089,2090],{},"Record\u003Cstring, unknown>",[213,2092,2093],{},"Optional custom data attached to worker presence.",[198,2095,2096,2101,2106],{},[213,2097,2098],{},[27,2099,2100],{},"queues",[213,2102,2103],{},[27,2104,2105],{},"string[]",[213,2107,2108],{},"Queues to join once the wrapper is ready.",[198,2110,2111,2115,2119],{},[213,2112,2113],{},[27,2114,139],{},[213,2116,2117],{},[27,2118,2011],{},[213,2120,2121,2122,2125],{},"Subscribe-level load-balance group for workers (default ",[27,2123,2124],{},"'queue-workers-\u003CqueueName>'","). Set a custom group to partition workers by region or capability.",[198,2127,2128,2133,2137],{},[213,2129,2130],{},[27,2131,2132],{},"maxJobCache",[213,2134,2135],{},[27,2136,2067],{},[213,2138,2139,2140,2143],{},"Max jobs cached in memory per queue (default ",[27,2141,2142],{},"1000",").",[198,2145,2146,2151,2156],{},[213,2147,2148],{},[27,2149,2150],{},"debug",[213,2152,2153],{},[27,2154,2155],{},"boolean",[213,2157,2158,2159,2143],{},"Enable wrapper debug logging (default ",[27,2160,2161],{},"false",[192,2163,2164,2176],{},[195,2165,2166],{},[198,2167,2168,2171,2174],{},[201,2169,2170],{},"Method",[201,2172,2173],{},"Returns",[201,2175,1980],{},[208,2177,2178,2193,2207,2225,2239,2254],{},[198,2179,2180,2185,2190],{},[213,2181,2182],{},[27,2183,2184],{},"ready()",[213,2186,2187],{},[27,2188,2189],{},"Promise\u003Cvoid>",[213,2191,2192],{},"Resolves once wrapper setup completed. Join methods throw before this resolves.",[198,2194,2195,2199,2204],{},[213,2196,2197],{},[27,2198,498],{},[213,2200,2201],{},[27,2202,2203],{},"void",[213,2205,2206],{},"Release this wrapper's handlers and topics; terminal, never closes the socket.",[198,2208,2209,2214,2218],{},[213,2210,2211],{},[27,2212,2213],{},"joinQueue(name, opts?)",[213,2215,2216],{},[27,2217,116],{},[213,2219,2220,2221,2224],{},"Subscribe to a named queue and return it. Synchronous; returns the existing instance if already joined. ",[27,2222,2223],{},"opts.filters"," declares the job filter values this participant wants (for a worker, its capabilities).",[198,2226,2227,2232,2236],{},[213,2228,2229],{},[27,2230,2231],{},"leaveQueue(name)",[213,2233,2234],{},[27,2235,2203],{},[213,2237,2238],{},"Unsubscribe from a queue and release its resources.",[198,2240,2241,2246,2251],{},[213,2242,2243],{},[27,2244,2245],{},"getQueues()",[213,2247,2248],{},[27,2249,2250],{},"QueueRoom[]",[213,2252,2253],{},"All currently joined queues.",[198,2255,2256,2261,2266],{},[213,2257,2258],{},[27,2259,2260],{},"getOnlineWorkers()",[213,2262,2263],{},[27,2264,2265],{},"QueueWorker[]",[213,2267,2268,2269,2271],{},"Workers currently present in the ",[27,2270,278],{}," lobby.",[71,2273,2275],{"id":2274},"nolagqueue-events","NoLagQueue Events",[192,2277,2278,2290],{},[195,2279,2280],{},[198,2281,2282,2285,2288],{},[201,2283,2284],{},"Event",[201,2286,2287],{},"Payload",[201,2289,1980],{},[208,2291,2292,2305,2320,2332,2344,2359,2374],{},[198,2293,2294,2299,2302],{},[213,2295,2296],{},[27,2297,2298],{},"connected",[213,2300,2301],{},"none",[213,2303,2304],{},"Wrapper setup completed on a live connection.",[198,2306,2307,2312,2317],{},[213,2308,2309],{},[27,2310,2311],{},"disconnected",[213,2313,2314],{},[27,2315,2316],{},"reason: string",[213,2318,2319],{},"Connection closed.",[198,2321,2322,2327,2329],{},[213,2323,2324],{},[27,2325,2326],{},"reconnecting",[213,2328,2301],{},[213,2330,2331],{},"The core client is attempting to reconnect.",[198,2333,2334,2339,2341],{},[213,2335,2336],{},[27,2337,2338],{},"reconnected",[213,2340,2301],{},[213,2342,2343],{},"Connection restored; queue membership and presence are restored automatically.",[198,2345,2346,2351,2356],{},[213,2347,2348],{},[27,2349,2350],{},"error",[213,2352,2353],{},[27,2354,2355],{},"error: Error",[213,2357,2358],{},"A transport or protocol error occurred.",[198,2360,2361,2366,2371],{},[213,2362,2363],{},[27,2364,2365],{},"workerOnline",[213,2367,2368],{},[27,2369,2370],{},"worker: QueueWorker",[213,2372,2373],{},"A worker joined the lobby.",[198,2375,2376,2381,2385],{},[213,2377,2378],{},[27,2379,2380],{},"workerOffline",[213,2382,2383],{},[27,2384,2370],{},[213,2386,2387],{},"A worker left the lobby.",[71,2389,116],{"id":2390},"queueroom",[192,2392,2393,2406],{},[195,2394,2395],{},[198,2396,2397,2399,2402,2404],{},[201,2398,2170],{},[201,2400,2401],{},"Role",[201,2403,2173],{},[201,2405,1980],{},[208,2407,2408,2436,2462,2480,2506,2535,2553,2574,2593,2610,2626],{},[198,2409,2410,2415,2417,2422],{},[213,2411,2412],{},[27,2413,2414],{},"addJob(opts)",[213,2416,523],{},[213,2418,2419],{},[27,2420,2421],{},"Job",[213,2423,2424,2425,2428,2429,2432,2433,2435],{},"Enqueue a job. ",[27,2426,2427],{},"opts"," is ",[27,2430,2431],{},"{ type, payload?, priority?, maxAttempts?, filter?, filters? }","; ",[27,2434,995],{}," is required, the id is generated.",[198,2437,2438,2443,2445,2450],{},[213,2439,2440],{},[27,2441,2442],{},"claimJob(jobId)",[213,2444,973],{},[213,2446,2447],{},[27,2448,2449],{},"Job | null",[213,2451,2452,2453,2455,2456,2458,2459,2461],{},"Move a ",[27,2454,29],{}," job to ",[27,2457,33],{}," and broadcast it. ",[27,2460,164],{}," if the job is unknown locally or not pending.",[198,2463,2464,2469,2471,2475],{},[213,2465,2466],{},[27,2467,2468],{},"reportProgress(jobId, progress)",[213,2470,973],{},[213,2472,2473],{},[27,2474,2203],{},[213,2476,2477,2478,507],{},"Broadcast a progress value (0-100) on ",[27,2479,124],{},[198,2481,2482,2487,2489,2493],{},[213,2483,2484],{},[27,2485,2486],{},"completeJob(jobId, result?)",[213,2488,973],{},[213,2490,2491],{},[27,2492,2449],{},[213,2494,2495,2496,2498,2499,2501,2502,41,2504,507],{},"Mark the job ",[27,2497,40],{}," with an optional result. ",[27,2500,164],{}," if the job is unknown locally or not in ",[27,2503,33],{},[27,2505,36],{},[198,2507,2508,2513,2515,2519],{},[213,2509,2510],{},[27,2511,2512],{},"failJob(jobId, error?)",[213,2514,973],{},[213,2516,2517],{},[27,2518,2449],{},[213,2520,2495,2521,2523,2524,2526,2527,2529,2530,503,2532,2534],{},[27,2522,44],{}," and increment ",[27,2525,921],{},". While ",[27,2528,175],{}," it returns to ",[27,2531,29],{},[27,2533,182],{}," fires immediately.",[198,2536,2537,2542,2545,2550],{},[213,2538,2539],{},[27,2540,2541],{},"getJob(id)",[213,2543,2544],{},"Any",[213,2546,2547],{},[27,2548,2549],{},"Job | undefined",[213,2551,2552],{},"Read a job from the local cache.",[198,2554,2555,2560,2562,2567],{},[213,2556,2557],{},[27,2558,2559],{},"getJobs(filter?)",[213,2561,2544],{},[213,2563,2564],{},[27,2565,2566],{},"Job[]",[213,2568,2569,2570,2573],{},"Read cached jobs, optionally filtered by ",[27,2571,2572],{},"{ status?, type?, priority? }",". Does not change what the server sends.",[198,2575,2576,2581,2583,2587],{},[213,2577,2578],{},[27,2579,2580],{},"pendingCount",[213,2582,2544],{},[213,2584,2585],{},[27,2586,2067],{},[213,2588,2589,2590,2592],{},"Getter: cached jobs in the ",[27,2591,29],{}," state.",[198,2594,2595,2600,2602,2606],{},[213,2596,2597],{},[27,2598,2599],{},"activeCount",[213,2601,2544],{},[213,2603,2604],{},[27,2605,2067],{},[213,2607,2589,2608,2592],{},[27,2609,36],{},[198,2611,2612,2617,2619,2623],{},[213,2613,2614],{},[27,2615,2616],{},"getWorkers()",[213,2618,2544],{},[213,2620,2621],{},[27,2622,2265],{},[213,2624,2625],{},"Workers present in this queue.",[198,2627,2628,2640,2642,2646],{},[213,2629,2630,2633,2634,2633,2637],{},[27,2631,2632],{},"setFilters(values)"," / ",[27,2635,2636],{},"addFilters(values)",[27,2638,2639],{},"removeFilters(values)",[213,2641,2544],{},[213,2643,2644],{},[27,2645,2203],{},[213,2647,2648],{},"Change which job filter values this participant receives. Filters compose with load balancing: one matching worker gets each job.",[71,2650,2652],{"id":2651},"queueroom-events","QueueRoom Events",[15,2654,2655,2656,2658,2659,2661],{},"All lifecycle events carry the full ",[27,2657,2421],{},". Producers and monitors receive every ",[27,2660,157],{},"; within a worker group only one worker does. The later events are emitted only on clients that already hold the job in their cache.",[192,2663,2664,2674],{},[195,2665,2666],{},[198,2667,2668,2670,2672],{},[201,2669,2284],{},[201,2671,2287],{},[201,2673,1980],{},[208,2675,2676,2689,2705,2723,2741,2762,2778,2792],{},[198,2677,2678,2682,2686],{},[213,2679,2680],{},[27,2681,157],{},[213,2683,2684],{},[27,2685,2421],{},[213,2687,2688],{},"A new job was added. Delivered to one worker per group, and to every producer and monitor.",[198,2690,2691,2695,2699],{},[213,2692,2693],{},[27,2694,153],{},[213,2696,2697],{},[27,2698,2421],{},[213,2700,2701,2702,2704],{},"A worker claimed a job; ",[27,2703,1713],{}," names it.",[198,2706,2707,2712,2717],{},[213,2708,2709],{},[27,2710,2711],{},"jobProgress",[213,2713,2714],{},[27,2715,2716],{},"JobProgress",[213,2718,2719,2720,507],{},"A worker reported progress: ",[27,2721,2722],{},"{ jobId, progress, workerId, timestamp }",[198,2724,2725,2730,2734],{},[213,2726,2727],{},[27,2728,2729],{},"jobCompleted",[213,2731,2732],{},[27,2733,2421],{},[213,2735,2736,2737,2740],{},"A job completed; ",[27,2738,2739],{},"result"," carries the payload.",[198,2742,2743,2748,2752],{},[213,2744,2745],{},[27,2746,2747],{},"jobFailed",[213,2749,2750],{},[27,2751,2421],{},[213,2753,2754,2755,30,2757,503,2759,2761],{},"A job failed; ",[27,2756,2350],{},[27,2758,921],{},[27,2760,51],{}," describe the state.",[198,2763,2764,2768,2772],{},[213,2765,2766],{},[27,2767,182],{},[213,2769,2770],{},[27,2771,2421],{},[213,2773,2774,2775,2777],{},"A failed job was returned to ",[27,2776,29],{}," for another attempt.",[198,2779,2780,2785,2789],{},[213,2781,2782],{},[27,2783,2784],{},"workerJoined",[213,2786,2787],{},[27,2788,2370],{},[213,2790,2791],{},"A worker joined this queue.",[198,2793,2794,2799,2803],{},[213,2795,2796],{},[27,2797,2798],{},"workerLeft",[213,2800,2801],{},[27,2802,2370],{},[213,2804,2805],{},"A worker left this queue.",[71,2807,2809],{"id":2808},"types","Types",[192,2811,2812,2821],{},[195,2813,2814],{},[198,2815,2816,2818],{},[201,2817,1977],{},[201,2819,2820],{},"Shape",[208,2822,2823,2834,2846,2862],{},[198,2824,2825,2829],{},[213,2826,2827],{},[27,2828,2421],{},[213,2830,2831],{},[27,2832,2833],{},"{ id, type, payload?, priority, status, progress, result?, error?, attempts, maxAttempts, claimedBy?, createdBy, createdAt, updatedAt, completedAt?, filter?, isReplay }",[198,2835,2836,2841],{},[213,2837,2838],{},[27,2839,2840],{},"JobStatus",[213,2842,2843],{},[27,2844,2845],{},"'pending' | 'claimed' | 'active' | 'completed' | 'failed'",[198,2847,2848,2853],{},[213,2849,2850],{},[27,2851,2852],{},"JobPriority",[213,2854,2855,2074,2858,2861],{},[27,2856,2857],{},"'low' | 'normal' | 'high' | 'critical'",[27,2859,2860],{},"'normal'",")",[198,2863,2864,2869],{},[213,2865,2866],{},[27,2867,2868],{},"QueueWorker",[213,2870,2871],{},[27,2872,2873],{},"{ workerId, actorTokenId, role, activeJobs, concurrency, metadata?, joinedAt, isLocal }",[2875,2876,2877],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}",{"title":294,"searchDepth":322,"depth":322,"links":2879},[2880,2883,2884,2885,2886],{"id":21,"depth":322,"text":22,"children":2881},[2882],{"id":73,"depth":329,"text":74},{"id":99,"depth":322,"text":100},{"id":459,"depth":322,"text":460},{"id":510,"depth":322,"text":511},{"id":1956,"depth":322,"text":1957,"children":2887},[2888,2889,2890,2891,2892],{"id":1960,"depth":329,"text":68},{"id":2274,"depth":329,"text":2275},{"id":2390,"depth":329,"text":116},{"id":2651,"depth":329,"text":2652},{"id":2808,"depth":329,"text":2809},"md",{},"/docs/high-level-sdks/queue",{"title":5,"description":17},"docs/high-level-sdks/queue","aF7LqGRBNbDUThB2z4RDG1hZ6zGvhqSu4m5c3bhQEk4",1789869420529]