Download the PHP package liniopay/idle without Composer
On this page you can find all versions of the php package liniopay/idle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download liniopay/idle
More information about liniopay/idle
Files in liniopay/idle
Informations about the package idle
Compatibility
PHP | Tag | Branch |
---|---|---|
^8.1 | 5.X | master |
^7.2 | 4.X | 7.2 |
Idle
Idle is a package for managing Job and Messaging systems. The two aspects work in harmony to make message queueing and job processing breeze.
Installing Idle
Composer
The recommended way to install Idle is through Composer.
Next, install the latest stable version of Idle:
Prepare your configurations
Idle requires four different configurations: service, message, job, and worker. We provide some samples to get you started in both array and yaml (symfony parser) syntax.
Sample Pimple Services (config/pimple.php)
Below is a look at the sample container setup for pimple. Keep in mind most of these services are optional. You can mix and match the ones you need.
Good to go!
Idle should be ready to run!
Messaging
The messaging component allows us to interact with messaging services.
- Queue
- A
Queue
based implementation entails creating a message which contains data you will need at a later date. The message is then sent to a queueing service which will hold it in aqueue
until it is retrieved. - Idle currently ships with
AWS SQS
andGoogle CloudTasks
, as queueing services. It is very simple to add adapters for other services by implementing the corresponding Service interface. - Idle utilizes
QueueMessage
to manage these type of messages and facilitate communication to the corresponding service.
- A
- Publish/Subscribe
- A
Publish/Subscribe
implementation is similar to a queue based implementation, but allows for more flexibility when retrieving messages. From an architectural point of view it consists of onetopic
and one or moresubscriptions
. When a message is sent to a giventopic
, it will forward the message to each of itssubscription(s)
. Each of thesubscription(s)
will then process the message in their own way. - Idle currently ships with
Google PubSub
as aPublish/Subscribe
service. - Idle utilizes two main types of message for dealing with Publish/Subscribe:
TopicMessage
which can be published to atopic
.SubscriptionMessage
which can be obtained via pull or push from asubscription
).
- A
Service Config
This config defines support for messaging services such as SQS or PubSub. If you only need one, feel free to remove the others.
Message Config
This config defines the behavior of our supported message types: QueueMessage, TopicMessage, SubscriptionMessage. Depending on which service you utilize, you may use one or more of these.
Utilizing Messages
QueueMessage
A QueueMessage can be used to queue to a service or dequeue from a service.
-
Queue
- Dequeue
Cloud Tasks
Google CloudTasks is a queue service which performs a request when the message reaches the top of the queue. An example of this can be seen below:
Note: Google CloudTasks does not support dequeueing.
Topic Messages
A TopicMessage
is designed to allow us to publish messages into Publish Subscribe systems.
- Manually
- Simply create it from data.
Subscription Messages
A SubscriptionMessage
is a message which contains data which has been retrieved from a subscription
. This can happen from one of two actions:
-
Pull
- Query the service and obtain one or more SubscriptionMessage(s):
- Push
- A subscription service makes a request to the application and provides it with message data. We then instantiate a SubscriptionMessage directly from its data.
Utilizing Jobs
Job
In Idle, a job is responsible for coordinating workers to ensure they each carry out the actual work. Idle currently ships with two main types of jobs: SimpleJob and MessageJob.
Worker
A worker is the entity actually carrying out the work. Each job can be configured to have multiple workers under it. Idle ships with three base workers:
- Worker
- A
Worker
is a generic worker which performs some kind of task. - Idle currently ships with:
DeleteMessageWorker
, andAcknowledgeMessageWorker
.
- A
Job Config
Worker Config
SimpleJob
A SimpleJob
is a minimally configured job which runs one or more workers and reports the outcome.
MessageJob
MessageJob
is a job which processes data from Messages. Creating a MessageJob
is very straight forward when utilizing the JobFactory
.
Outputting job results
Idle includes an optional league/fractal
transformer to quickly output basic job details. This is located at src/Job/Output/Transformer/JobDetails.php
.
All versions of idle with dependencies
php Version ^8.1
laminas/laminas-stdlib Version ^3.16
psr/container Version ^2.0
psr/http-message Version ^1.0
psr/log Version ^3.0
ramsey/uuid Version ^4.0
google/cloud-tasks Version ^1.6