Skip to content

Documentation#250

Open
viktorprogger wants to merge 25 commits intomasterfrom
docs
Open

Documentation#250
viktorprogger wants to merge 25 commits intomasterfrom
docs

Conversation

@viktorprogger
Copy link
Copy Markdown
Contributor

Q A
Is bugfix? ✔️
New feature?
Breaks BC?

@viktorprogger viktorprogger changed the title Start docs refining Documentation Dec 13, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 13, 2025

Codecov Report

❌ Patch coverage is 97.72727% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.50%. Comparing base (4508fbe) to head (bb9bea8).

Files with missing lines Patch % Lines
src/Worker/Worker.php 92.85% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #250      +/-   ##
============================================
- Coverage     98.62%   98.50%   -0.13%     
+ Complexity      356      353       -3     
============================================
  Files            47       47              
  Lines           948      937      -11     
============================================
- Hits            935      923      -12     
- Misses           13       14       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@viktorprogger viktorprogger marked this pull request as ready for review January 7, 2026 15:19
@samdark samdark requested a review from Copilot January 7, 2026 19:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request is marked as a bugfix and includes significant documentation improvements, code refactoring, and a critical bug fix. The main changes involve integrating CallableFactory into the Worker class to simplify handler resolution, fixing a bug in the JSON message serializer, adding comprehensive documentation, and adding a command alias.

Key changes:

  • Integration of CallableFactory into Worker for unified callable resolution
  • Bug fix in JsonMessageSerializer where $payload['meta'] was incorrectly accessed instead of $meta
  • Extensive documentation added covering queue channels, message handlers, middleware pipelines, error handling, and more
  • Command alias queue:listen-all added to replace the typo queue:listen:all

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/Unit/WorkerTest.php Added new test case for object method callable definitions and updated tests to use CallableFactory parameter
tests/Unit/Middleware/CallableFactoryTest.php Major refactoring with data providers for comprehensive testing of callable factory scenarios
tests/TestCase.php Added CallableFactory parameter to worker creation
tests/Integration/MiddlewareTest.php Added CallableFactory parameter to test setup
tests/Integration/MessageConsumingTest.php Added CallableFactory instantiation and parameter in worker setup
tests/Benchmark/QueueBench.php Added CallableFactory parameter to worker constructor
src/Worker/Worker.php Integrated CallableFactory for unified handler resolution, simplified handler caching logic
src/Middleware/CallableFactory.php Enhanced to support Closure detection, object method definitions, and improved validation
src/Message/JsonMessageSerializer.php Bug fix: corrected variable reference from $payload['meta'] to $meta
src/Command/ListenAllCommand.php Added command alias 'queue:listen:all' for backward compatibility
docs/guide/en/worker.md Rewritten to focus on starting workers and supervisor configuration
docs/guide/en/usage.md Expanded with queue channels, delayed execution, job status examples
docs/guide/en/producing-messages-from-external-systems.md New comprehensive guide for external message producers
docs/guide/en/prerequisites-and-installation.md New installation and requirements guide
docs/guide/en/middleware-pipelines.md New detailed middleware pipeline documentation
docs/guide/en/message-handler.md New guide explaining handler definition formats and configuration
docs/guide/en/loops.md New documentation on loop interface and signal handling
docs/guide/en/job-status.md New guide on job status tracking
docs/guide/en/error-handling.md Significantly expanded with step-by-step failure handling flow
docs/guide/en/envelopes.md New documentation on envelope pattern and metadata handling
docs/guide/en/debug-integration.md New guide for Yii Debug integration
docs/guide/en/console-commands.md New comprehensive console commands reference
docs/guide/en/configuration-with-config.md New configuration guide for yiisoft/config users
docs/guide/en/configuration-manual.md New manual configuration guide with examples
docs/guide/en/channels.md New detailed guide on queue channels concept and configuration
docs/guide/en/callable-definitions-extended.md New guide explaining extended callable definition formats
docs/guide/en/README.md Restructured guide index with better organization
config/params.php Added 'queue:listen-all' command alias
README.md Major rewrite with quick start guide and improved structure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Configuration
## When failure handling is triggered

Failure handling is triggered only when message processing throws a `Throwable`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about PHP notices or warnings or errors?

'queue:run' => RunCommand::class,
'queue:listen' => ListenCommand::class,
'queue:listen:all' => ListenAllCommand::class,
'queue:listen-all' => ListenAllCommand::class,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was alright. The console works the best when the separator is :.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 38 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 56 to 65
$name = $message->getHandlerName();
$handler = $this->getHandler($name);
try {
$handler = $this->getHandler($name);
} catch (InvalidCallableConfigurationException $exception) {
throw new RuntimeException(sprintf('Queue handler with name "%s" does not exist.', $name), 0, $exception);
}

if ($handler === null) {
throw new RuntimeException(sprintf('Queue handler with name "%s" does not exist', $name));
}
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process() throws two different error messages for missing/invalid handler definitions: the InvalidCallableConfigurationException path ends with a period (... does not exist.) while the null handler path does not (... does not exist). This difference breaks tests that expect a stable message and makes error handling brittle. Consider using a single canonical message string for both paths (or update tests/BC accordingly).

Copilot uses AI. Check for mistakes.
Comment on lines 30 to +43
$this->addArgument(
'channel',
InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
'Queue channel name list to connect to.',
$this->channels,
)
->addOption(
'maximum',
'limit',
'm',
InputOption::VALUE_REQUIRED,
'Maximum number of messages to process in each channel. Default is 0 (no limits).',
'Number of messages to process in each channel. Default is 0 (no limits).',
0,
)
->addUsage('[channel1 [channel2 [...]]] --maximum 100');
->addUsage('[channel1 [channel2 [...]]] --limit 100');
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI option name was changed from --maximum to --limit. That is a backwards-incompatible change for anyone scripting this command, but the PR metadata says BC is not broken. Consider supporting --maximum as a deprecated alias (or documenting this as a BC break and updating release notes).

Copilot uses AI. Check for mistakes.
Comment on lines 44 to +60
->addOption(
'pause',
'p',
InputOption::VALUE_REQUIRED,
'Pause between queue channel iterations in seconds. May save some CPU. Default: 1',
1,
)
->addOption(
'maximum',
'limit',
'm',
InputOption::VALUE_REQUIRED,
'Maximum number of messages to process in each channel before switching to another channel. '
'Number of messages to process in each channel before switching to another channel. '
. 'Default is 0 (no limits).',
0,
);

$this->addUsage('[channel1 [channel2 [...]]] [--timeout=<timeout>] [--maximum=<maximum>]');
$this->addUsage('[channel1 [channel2 [...]]] [--pause=<pause>] [--limit=<limit>]');
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The queue:listen-all command option was renamed from --maximum to --limit. This is a breaking CLI interface change (scripts/ops tooling will fail) while the PR metadata indicates no BC break. Consider keeping --maximum as an alias (possibly deprecated) or updating the PR metadata / changelog to reflect the breaking change.

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +33
- [Middleware pipelines deep dive](middleware-pipelines.md) — dispatcher lifecycle, request mutations, and per-pipeline contracts.
- [Callable definitions and middleware factories](callable-definitions-extended.md) — container-aware definitions for middleware factories.
- [Error handling](error-handling.md#failure-pipeline-overview) — end-to-end flow of the failure pipeline.
- [Custom failure middleware](error-handling.md#how-to-create-a-custom-failure-middleware) — implementing `MiddlewareFailureInterface`.
- [Envelope metadata and stack reconstruction](envelopes.md#metadata-and-envelope-stacking) — stack resolution and metadata merging.
- [FailureEnvelope usage](error-handling.md#failureenvelope) — retry metadata semantics.
- [Handler resolver pipeline](message-handler.md#resolver-pipeline) — alternative handler lookup strategies.

## Queue adapters and interoperability

- [Custom queue provider implementations](queue-names-advanced.md#extending-the-registry) — bespoke selection logic, tenant registries, and fallback strategies.
- [Consuming messages from external systems](consuming-messages-from-external-systems.md) — contract for third-party producers.
- [Adapter internals](adapter-list.md#available-adapters) — extend or swap backend adapters.

## Tooling, diagnostics, and storage

- [Yii Debug collector internals](debug-integration-advanced.md) — collector internals, proxies, and manual wiring.
- [Job status storage extensions](job-status.md#extend-storage) — persisting custom metadata or drivers.
- [Extending queue processes and supervisors](process-managers.md#custom-supervisors) — custom supervisor hooks and graceful shutdown integration.
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several anchors referenced here don’t exist in the target docs, so these links are currently broken on GitHub: error-handling.md#failure-pipeline-overview (heading is different), message-handler.md#resolver-pipeline, job-status.md#extend-storage, and process-managers.md#custom-supervisors. Please update the anchors (or add the missing sections) so the documentation map is navigable.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants