Download the PHP package t3n/jobqueue-log without Composer
On this page you can find all versions of the php package t3n/jobqueue-log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download t3n/jobqueue-log
More information about t3n/jobqueue-log
Files in t3n/jobqueue-log
Package jobqueue-log
Short Description A sidecar package for t3n.JobQueue.RabbitMQ to publish logs
License MIT
Informations about the package jobqueue-log
t3n.JobQueue.Log
A sidecar package for t3n.JobQueue.RabbitMQ. This package will log infos about submitted, failed and finished jobs to a RabbitMQ backend. This package could also be used to simply log some custom messages.
Setup
To use RabbitMQ as a backend for a JobQueue you need a running RabbitMQ Service. You can use our docker image which also includes the management console t3n/rabbitmq
Install the package using composer:
Configuration
For a basic setup of RabbitMQ Queues check t3n.JobQueue.RabbitMQ. This section will only cover the additional configuration.
There are some preconfigured queues:
Adjust those queues to fit your needs. You probably want to adjust the routing key as well as the preset / exchange configuration. Those queue names are used internally, so make sure you got those covered! We won't declare them as they only act as a producer. There is no need to declare or persist them for now.
Now add a consumer queue like this:
This queue uses a TransientRabbitQueue. This is important as we override the default queue options
to make sure it has a unique name so you several consumer can connect and all messages
are forwarded to each consumer. The queue will also only exist as long as a consumer is
connected (realised with the exclusive
flag).
This queue now would receive all logs with all severities. If you only need warnings adjust
the routing key to your needs or configure another consumer queue.
We wont log anything by default but is able to log logs for submitted, failed and finished jobs.
You can enable logging in your Settings.yaml
:
Usage
After you configured your producer and consumer queues there is a flow command to output all logs:
The severity flag controls whether to log only failed Jobs (warning
), submitted jobs (info
)
or finished jobs (success
). By default all logs (*
) are outputted.
Setting verbose to true will also display some more meta information.
Send generic messages
This package is made to have a live overview of your jobqueues. But you can also use it
to send some generic logs. Therefore we added the severity message
.
Sending a message to all consumers:
The queue name, routing keys etc. can be customized to fit your needs!