Documentation - Jobs
====================

Every job must implement the interface `SlmQueue\Job\JobInterface`. This interface defines four methods: `getId()` /
`setId()`, `jsonSerialize()` and `execute()`. The getter and setter for the id is required to track unique jobs. Most
queues use an identifier when a job is pushed into the queue and the identifier is returned together with the payload
when a job is popped. The serialization to json is required since job queues accept string values
as payload, but SlmQueue allows the payload to be arbitrarily of any type. The last method, `execute()`, is called when
the job has to "do" it jobs.

For ease of use, all method except `execute()` are provided by an abstract class. Extend `SlmQueue\Job\AbstractJob` to
ease the creation of jobs. This ...

```php
namespace MyModule\Job;

use SlmQueue\Job\AbstractJob;

class PrintHelloWorldJob extends AbstractJob
{
    public function execute()
    {
        echo 'Hello World';
    }
}
```

Navigation
----------

Previous page: [Configuration](2.Configuration.md)
Next page: [Queue Aware](4.QueueAware.md)

1. [Introduction](1.Introduction.md)
2. [Configuration](2.Configuration.md)
3. [Jobs](3.Jobs.md)
4. [QueueAware](4.QueueAware.md)
5. [Internals](5.Internals.md)
6. [Events](6.Events.md)
7. [Worker management](7.WorkerManagement.md)

Documentation - Jobs
====================

Every job must implement the interface `SlmQueue\Job\JobInterface`. This interface defines four methods: `getId()` /
`setId()`, `jsonSerialize()` and `execute()`. The getter and setter for the id is required to track unique jobs. Most
queues use an identifier when a job is pushed into the queue and the identifier is returned together with the payload
when a job is popped. The serialization to json is required since job queues accept string values
as payload, but SlmQueue allows the payload to be arbitrarily of any type. The last method, `execute()`, must be
implemented in userland code.

For ease of use, all method except `execute()` are provided by an abstract class. Extend `SlmQueue\Job\AbstractJob` to
ease the creation of jobs. This ...

```php
namespace MyModule\Job;

use SlmQueue\Job\AbstractJob;

class PrintHelloWorldJob extends AbstractJob
{
    public function execute()
    {
        echo 'Hello World';
    }
}
```

Navigation
----------

Previous page: [Configuration](2.Configuration.md)
Next page: [Queue Aware](4.QueueAware.md)

1. [Introduction](1.Introduction.md)
2. [Configuration](2.Configuration.md)
3. [Jobs](3.Jobs.md)
4. [QueueAware](4.QueueAware.md)
5. [Internals](5.Internals.md)
6. [Events](6.Events.md)
7. [Worker management](7.WorkerManagement.md)

Simplify explanation of the execute() method
Simplify explanation of the execute() method
