شعار Hor Renchan Job Bullmq

Hor Renchan Job Bullmq

مؤسسة
openreachtech
hor-renchan-job-bullmq

Write and wire background jobs with @openreachtech/renchan-job-bullmq (BullMQ on Redis). Use this skill whenever the user asks to add or edit a job under app/jobs/** — a Manifest / Worker / Dispatcher triple, a cron or interval (repeatable) job, enqueuing from a GraphQL/REST resolver, publishing progress to a GraphQL subscription, the worker daemon entry point, splitting work across queues, tuning concurrency / retries / rate limits, the queue's Redis policy, or duplicate guards.

Add to TypingMind

نظرة عامة

الناشرopenreachtech
المستودعhora-skills-ort-renchan
اسم المهارةhor-renchan-job-bullmq
النجوم
32
التفريعات
0
الملفات المرفقة
5
الترخيصApache-2.0
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 5

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها openreachtech على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Hor Renchan Job Bullmq في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-renchan-job-bullmq
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/openreachtech/hora-skills-ort-renchan.git /tmp/hora-skills-ort-renchan
mkdir -p .claude/skills
cp -r /tmp/hora-skills-ort-renchan/kit/skills/hor-renchan-job-bullmq .claude/skills/hor-renchan-job-bullmq
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Hor Renchan Job Bullmq في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Hor Renchan Job Bullmq تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Hor Renchan Job Bullmq بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

renchan-job-bullmq

@openreachtech/renchan-job-bullmq is this repo's job framework: BullMQ queues on Redis, wrapped in renchan base classes. A job is a small template of class files in one directory under app/jobs/<job-name>/. Two long-running processes share one Redis (pm2.config.cjs):

  • GraphQL API (server/index.js) — handles requests and enqueues jobs (producer).
  • Job Daemon (scripts/startJobDaemon.js) — runs the workers (consumer) and publishes progress back over Redis PubSub to the API's GraphQL subscriptions.

This overview maps each topic to a section; the specifics are in the detail files under references/. The package's own usage samples live in samples/confirm-01 (dispatch + daemon) and samples/confirm-02 (cron + interval schedulers) of the hor-renchan-job-bullmq package.

Core principle: a job is a filled-in template of 3–4 files

Each job is a directory app/jobs/<kebab-job-name>/ holding a fixed set of classes, each extending a renchan base, all pointing at one central Engine:

FileBase classResponsibility
<Name>JobManifest.jsBaseJobManifestthe queue name (jobName) + the body schema
<Name>JobWorker.jsBaseJobWorkerconsume: executeJob() + lifecycle hooks
<Name>JobDispatcher.jsBaseJobDispatcherproduce: enqueue + per-queue optionHash
<Name>CronJobScheduler.js / <Name>IntervalJobScheduler.jsBaseCronJobScheduler / BaseIntervalJobScheduler(scheduled jobs) register a repeatable job

Keep the layout identical across jobs so review attention goes to the job's logic. Directory = kebab = jobName; classes are PascalCase with those fixed suffixes. Structural comments are English; the domain-explanation comments in the real files are Japanese (they cite the plan, T-JOB-*) — match the surrounding code.

1. Basic usage — the Manifest / Worker / Dispatcher triple

  • Manifest — jobName (the queue name, == the directory) + bodySchema (ScalarHash scalars Text / Integer / … from @openreachtech/mentsu-schema). Keep the body minimal (ids/tokens).
  • Worker — static get ManifestCtor() + async executeJob({ body, context, parcel }) + the four abstract lifecycle hooks (onJobCompleted / onJobFailed / onJobProgress / onWorkerError). executeJob's return value is stored in Redis — return only the minimum, never entity arrays. Override buildOptionHash() for concurrency / limiter.
  • Dispatcher — static get EngineCtor() + static get ManifestCtor() + optional static get optionHash() (BullMQ QueueOptions, e.g. defaultJobOptions.attempts). To stay DRY, a base app dispatcher can set EngineCtor once so each job dispatcher only sets ManifestCtor.
js
// Manifest — the source of truth for the queue name and payload shape
export default class SendReportEmailJobManifest extends BaseJobManifest {
  /** @override */ static get jobName () { return 'send-report-email' }

  /** @override */
  static get bodySchema () {
    return {
      sessionToken: Text,
    }
  }
}

Enqueue from a resolver via the request-scope JobDispatcherProvider (connection reuse):

js
await context.share.jobDispatcherProvider.dispatchJob({
  DispatcherCtor: SendReportEmailJobDispatcher,
  body: {
    sessionToken,
  },
})

Standalone (one-off): const dispatcher = await Dispatcher.createAsync(); await dispatcher.dispatchJob({ body }); await dispatcher.teardown() — dispatchJob returns a response with hasError() / hasResponse() / createDispatchedAt().

Full classes, hooks, the base-app-dispatcher pattern, and the enqueue paths are in job-triple.md.

2. Engine / Share / Context / RedisConnection

  • Engine (ContentGenerationJobEngine.js) — the one config object: config = { workersPath, schedulersPath, redisConfig } (both paths point at app/jobs), plus ShareCtor / ContextCtor, error codes, log path. createAsync({ subscriptionBroker }) injects the progress broker (§4).
  • Share is the per-process DI (holds subscriptionBroker or null, env, timber, …). It is the only class that imports env.
  • Context — per-job DI, created for each run and passed to executeJob.
  • RedisConnection (app/queue/RedisConnection.js) is created by the Share with the env (ContentGenerationJobShare.createRedisConnection()), and gives generateConnectionOptions() for BullMQ (maxRetriesPerRequest: null required) and generatePubSubOptions() for the broker. API and Daemon must share one Redis. That Redis must run with maxmemory-policy noeviction; an evicting policy corrupts the queues.

Details and the package-exports table are in engine-and-infra.md.

3. Entry points — the worker Daemon and the scheduler

Worker Daemon — JobWorkersDaemon auto-discovers every BaseJobWorker under workersPath (DeepBulkClassLoader), binds each to its jobName, and installs graceful SIGINT/SIGTERM shutdown. Two boot shapes:

  • Simple (no progress broker): JobWorkersDaemon.createAsync({ EngineCtor }).then(daemon => daemon.startDaemon()).
  • With a broker (this repo, scripts/startJobDaemon.js): build a SubscriptionBroker, inject it via Engine.createAsync({ subscriptionBroker }), then JobWorkersDaemon.loadWorkerCtors({ engine }) → .create({ engine, WorkerCtors }).startDaemon().

Scheduler registration is a one-shot script (scripts/start-schedule.js): SchedulerService.createAsync({ EngineCtor }) → startAllSchedulers() → exit. It writes repeatable jobs to Redis; the Daemon consumes them. stopAllSchedulers() removes them without stopping the Daemon.

pm2 (pm2.config.cjs) runs GraphQL API and Job Daemon.

Both boot paths, cron and interval schedulers, and the start/stop scripts are in daemon-and-scheduler.md.

4. Integrating with subscriptions (progress → GraphQL)

A worker in the Daemon publishes progress on a channel namespaced by a scope; a GraphQL subscription in the API process subscribes with the same channel + scope, over the shared Redis PubSub broker.

  • The Daemon injects the broker (§3, Path B); enqueue-only processes pass none → publish is a no-op.
  • AI workers get this automatically from BaseAgentJobWorker; the app base BaseContentGenerationJobWorker.js sets channel = 'reportProgress' and buildScope (accessToken else jobId).
  • The subscriber (OnReportProgressSubscriptionResolver.js) must match the channel and scope. This is why the public-lp queue body carries accessToken (§5).

The publish/subscribe wiring and checklist are in subscriptions.md.

5. Splitting queues

One queue == one job directory == one Manifest jobName. The repo splits the same content-generation work into content-generation-internal ({ jobId }) and content-generation-public-lp ({ jobId, accessToken }) so they scale and subscribe independently.

  • Share logic via an app base worker, but place that base OUTSIDE workersPath — the Daemon boots every BaseJobWorker under app/jobs, and an abstract base without a jobName crashes startup. Only concrete workers go under app/jobs/**.
  • Run a subset of queues per Daemon with skipJobHash ({ [jobName]: true }).
  • Tune per queue: Dispatcher optionHash (attempts) + Worker buildOptionHash() (concurrency, limiter).

Details and the directory diagram are in queues.md.

6. Other building blocks

  • Cron / interval jobs — BaseCronJobScheduler ({ cronExpression }) or BaseIntervalJobScheduler ({ millisecond, isImmediately }), listed in SchedulerService.collectScheduleInputs() with a schedulerId matching the scheduler class. See daemon-and-scheduler.md.
  • Connection reuse — JobDispatcherProvider (app/tools/JobDispatcherProvider.js) caches one Dispatcher per DispatcherCtor and dispatches with keepsConnection: true; the request Share holds one, torn down on process exit. Prefer it over Dispatcher.createAsync() per request.
  • Retries & idempotency — set attempts in optionHash; make executeJob idempotent (BullMQ may re-run). Expensive AI jobs checkpoint to content_generations.intermediate_steps_json and resume on retry. onJobFailed fires on every failed attempt, so treat a job as finally failed only when jobModel.job.finishedOn is a number, never by comparing attemptsMade with attempts (job-triple.md).
  • Duplicate guard: to keep identical requests from enqueuing twice, pass optionHash: { deduplication: { id } } to dispatchJob rather than a custom jobId (job-triple.md).
  • Concurrency & rate limiting — buildOptionHash() forwards concurrency + limiter (app/tools/ContentGenerationRateLimiter.js).
  • Testing — unit-test workers/dispatchers with the hoc-jest skill.

Detail files

  • job-triple.md — Manifest / Worker / Dispatcher in full, body schema, lifecycle hooks, the return-value-in-Redis rule, base-app-dispatcher DRY, enqueue paths (§1)
  • engine-and-infra.md — Engine config, Share, Context, RedisConnection, package exports (§2)
  • daemon-and-scheduler.md — JobWorkersDaemon (both boot paths), scripts/*, cron + interval schedulers, the scheduler service, pm2 (§3, §6)
  • subscriptions.md — progress publish/subscribe, channel + scope, AI-worker plumbing (§4)
  • queues.md — splitting queues, shared-base placement, skipJobHash, per-queue tuning (§5)

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Hor Renchan Job Bullmq؟

Write and wire background jobs with @openreachtech/renchan-job-bullmq (BullMQ on Redis). Use this skill whenever the user asks to add or edit a job under app/jobs/** — a Manifest / Worker / Dispatcher triple, a cron or interval (repeatable) job, enqueuing from a GraphQL/REST resolver, publishing progress to a GraphQL subscription, the worker daemon entry point, splitting work across queues, tuning concurrency / retries / rate limits, the queue's Redis policy, or duplicate guards.

لماذا تستخدم Hor Renchan Job Bullmq على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Hor Renchan Job Bullmq عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Hor Renchan Job Bullmq في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/openreachtech/hora-skills-ort-renchan/tree/main/kit/skills/hor-renchan-job-bullmq. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Hor Renchan Job Bullmq؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Hor Renchan Job Bullmq؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Hor Renchan Job Bullmq معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Hor Renchan Job Bullmq مجانية؟

نعم. نشرها openreachtech على GitHub بموجب ترخيص Apache-2.0. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇