yiisoft / queue

Queue extension for Yii 3.0
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
54 stars 28 forks source link

Handler have access to the cli output of the worker #126

Closed romkatsu closed 2 years ago

romkatsu commented 2 years ago

Workers who process messages from the queue are often run through daemons. For example supervisor.

[program:my-queue-program]
command=php yii queue/listen --channel=download-images-queue
stdout_logfile=/logs/download-images-queue.log

It is very convenient when there is a log file for one worker.

The log file at the same time contains approximately the following:

Start processing queue messages.
Processed 1 queue messages.

And I would like to be able to write messages to output from the queue handler.

I suggest transmitting not only a message to the worker, but also a console logger.

samdark commented 2 years ago

I think it is a good idea.

viktorprogger commented 2 years ago

You can use dependency injection in your handler, where you can get any logger you want.

samdark commented 2 years ago

@romkatsu so... considering @viktorprogger comment, do we need it still?

viktorprogger commented 2 years ago

It seems like the question is settled.