Skip to content

Conversation

@viktorprogger
Copy link
Contributor

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

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

codecov bot commented Dec 13, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.88%. Comparing base (493a753) to head (eb27a90).

Files with missing lines Patch % Lines
src/Worker/Worker.php 83.33% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #250      +/-   ##
============================================
- Coverage     98.59%   97.88%   -0.72%     
- Complexity      356      362       +6     
============================================
  Files            47       47              
  Lines           927      945      +18     
============================================
+ Hits            914      925      +11     
- Misses           13       20       +7     

☔ 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.


- Optionally: define default `\Yiisoft\Queue\Adapter\AdapterInterface` implementation.
- And/or define channel-specific `AdapterInterface` implementations in the `channels` params key to be used
with the [queue provider](usage.md#different-queue-channels).
Copy link
Member

Choose a reason for hiding this comment

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

There's nothing in usage.md about queue provider and there's no such anchor as well.


## Where to put the configuration

In `yiisoft/app` / `yiisoft/app-api` templates you typically add or adjust configuration in `config/params.php`.
Copy link
Member

Choose a reason for hiding this comment

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

Worth linking package names everywhere.


Handler definitions are configured in:

- `$params['yiisoft/queue']['handlers']` when using `yiisoft/config`, or
Copy link
Member

Choose a reason for hiding this comment

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

Worth linking yiisoft/config package.


- Another application pushes messages to the same broker.
- A different language/runtime produces messages.
- You want a stable public contract that is independent from your PHP namespaces and refactorings.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- You want a stable public contract that is independent from your PHP namespaces and refactorings.
- You want a stable public contract that is independent of your PHP namespaces and refactorings.


## When mapping by short names is a better idea

While FQCN-as-name is convenient inside a single application, mapping by a short name is often a better contract when messages are produced outside of the current codebase, or when you want to create a stable public API for inter-service communication.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
While FQCN-as-name is convenient inside a single application, mapping by a short name is often a better contract when messages are produced outside of the current codebase, or when you want to create a stable public API for inter-service communication.
While FQCN-as-name is convenient inside a single application, mapping by a short name is often a better contract. That is true when messages are produced outside the current codebase, or when you want to create a stable public API for inter-service communication.


## Config location (yiisoft/config)

When using `yiisoft/config`, configure handlers under the `yiisoft/queue` params key:
Copy link
Member

Choose a reason for hiding this comment

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

Worth linking package names.


### 4. Send (produce/push) a message to a queue

To send a message to the queue, you need to get the queue instance and call the `push()` method. Typically with Yii Framework you'll get a `Queue` instance as a dependency of a service.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
To send a message to the queue, you need to get the queue instance and call the `push()` method. Typically with Yii Framework you'll get a `Queue` instance as a dependency of a service.
To send a message to the queue, you need to get the queue instance and call the `push()` method. Typically, with Yii Framework you'll get a `Queue` instance as a dependency of a service.


### 5. Handle queue messages

By default Yii Framework uses [yiisoft/yii-console](https://github.com/yiisoft/yii-console) to run CLI commands. If you installed [yiisoft/app](https://github.com/yiisoft/app) or [yiisoft/app-api](https://github.com/yiisoft/app-api), you can run the queue worker with on of these two commands:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
By default Yii Framework uses [yiisoft/yii-console](https://github.com/yiisoft/yii-console) to run CLI commands. If you installed [yiisoft/app](https://github.com/yiisoft/app) or [yiisoft/app-api](https://github.com/yiisoft/app-api), you can run the queue worker with on of these two commands:
By default, Yii Framework uses [yiisoft/yii-console](https://github.com/yiisoft/yii-console) to run CLI commands. If you installed [yiisoft/app](https://github.com/yiisoft/app) or [yiisoft/app-api](https://github.com/yiisoft/app-api), you can run the queue worker with on of these two commands:

./yii queue:listen # Start a daemon listening for new messages permanently
```

> In case you're using the SynchronosAdapter for development purposes, you should not use these commands, as you have no asynchronous processing available. The messages are processed immediately when pushed.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
> In case you're using the SynchronosAdapter for development purposes, you should not use these commands, as you have no asynchronous processing available. The messages are processed immediately when pushed.
> In case you're using the `SynchronosAdapter` for development purposes, you should not use these commands, as you have no asynchronous processing available. The messages are processed immediately when pushed.

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