mcpField
B
bitrix-background-jobs

bitrix-background-jobs

github.com/bxmaximumDevelopment47271 installsUpdated 2w ago
Repository

About bitrix-background-jobs

bitrix-background-jobs is a reference skill for implementing background work in Bitrix. It helps developers choose among scheduled agents, post-response jobs, Messenger queues, and console commands, while documenting execution context and reliability requirements.

Key features

  1. 01Guidance for choosing a job mechanism
  2. 02Scheduled and delayed agent guidance
  3. 03Post-response job guidance
  4. 04Messenger queue and retry guidance
  5. 05Idempotency and execution-context rules

Use cases

  1. 01Schedule periodic or delayed tasks
  2. 02Run short work after a response
  3. 03Process queued messages with retries
  4. 04Plan a one-off long migration

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/bxmaximum/bitrix-framework-skills --skill bitrix-background-jobs

After installing, type/bitrix-background-jobsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

rules/
agents.md
background-job.md
messenger-config.md
messenger.md

Details

From the project README

Background jobs

Baseline: main 23.0+ · Verified: main 26.800.0

TaskRead
Periodic or delayed task, agents on cron, long agentsrules/agents.md
Short tail work after the responserules/background-job.md
Queue: message, receiver, dispatch, retriesrules/messenger.md
Queue config, brokers, messenger:consume, kernel queuesrules/messenger-config.md

Pick: schedule → agent (on cron); seconds of work after the response → addBackgroundJob; retries, volume, parallel workers → Messenger (Since main 25.100.300, alpha); one-off long migration → console command (bitrix-console-commands).

Invariants

  • Background code has no user context: agents and receivers set global $USER = null; no $_SESSION/cookies. Pass user/site IDs explicitly.
  • On hits, agents, web-mode Messenger and addBackgroundJob() run after the response is sent, after OnAfterEpilog and session_write_close(), with the DB pool forced to master.
  • Keep job code thin: resolve a service via ServiceLocator::getInstance()->get() and call it (no constructor DI in agents — bitrix-framework).
  • Jobs must be idempotent: agents can run twice in parallel, messages can be redelivered.
  • Log failures through a PSR-3 logger (bitrix-logger); remove your agents on module uninstall.

Comments

Markdown supported