Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ QUEUE_DRIVER=sqs-plain
If you plan to push plain messages from Laravel or Lumen, you can rely on DispatcherJob:

```php
namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Dusterio\PlainSqs\Jobs\DispatcherJob;

class ExampleController extends Controller
Expand Down Expand Up @@ -140,7 +143,10 @@ If a third-party application is creating custom-format JSON messages, just add a
implement a handler class as follows:

```php
namespace App\Jobs;

use Illuminate\Contracts\Queue\Job as LaravelJob;
use Illuminate\Queue\Jobs\Job;

class HandlerJob extends Job
{
Expand All @@ -158,10 +164,15 @@ class HandlerJob extends Job
// Raw JSON payload from SQS, if necessary
var_dump($job->getRawBody());
}
}

public function getRawBody() {}

public function getJobId() {}
}
Copy link
Owner

Choose a reason for hiding this comment

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

actually, I think we can just remove "extends Job" completely (and therefore the two extra methods). All Laravel needs from a job class is the "handle" method, nothing else matters. This is the reason for confusion I think

Choose a reason for hiding this comment

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

Correct, I have used it like that (without extending Job) as a normal Laravel job and it works like a charm on the latest version 0.1.24

```

Please note, we are declaring the `getRawBody` and `getJobId` methods to satisfy the abstract class requirements. However, these are not used when processing messages.

## Todo

1. Add more unit and integration tests
Expand Down