Skip to content

Commit 5af2e2c

Browse files
author
palPalani
committed
Improved readme
1 parent ecbe1c0 commit 5af2e2c

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

README.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ return [
3434
* Separate queue handle with corresponding queue name as key.
3535
*/
3636
'handlers' => [
37-
//'stripe-webhooks' => App\Jobs\SqsHandler::class,
37+
//'stripe-webhooks' => App\Jobs\StripeHandler::class,
38+
//'mailgun-webhooks' => App\Jobs\MailgunHandler::class,
39+
//'shopify-webhooks' => App\Jobs\ShopifyHandler::class,
3840
],
3941

4042
'default-handler' => App\Jobs\SqsHandler::class
@@ -43,18 +45,18 @@ return [
4345

4446
If queue is not found in 'handlers' array, SQS payload is passed to default handler.
4547

46-
Add sqs-json connection to your config/queue.php, eg:
48+
Add `sqs-json` connection to your config/queue.php, Ex:
4749

4850
```php
4951
[
50-
// Add connection
52+
// Add new SQS connection
5153
'sqs-json' => [
5254
'driver' => 'sqs-json',
53-
'key' => env('AWS_KEY', ''),
54-
'secret' => env('AWS_SECRET', ''),
55-
'prefix' => 'https://sqs.us-west-2.amazonaws.com/3242342351/',
56-
'queue' => 'stripe-webhooks',
57-
'region' => 'ap-southeast-2',
55+
'key' => env('AWS_ACCESS_KEY_ID', ''),
56+
'secret' => env('AWS_SECRET_ACCESS_KEY', ''),
57+
'prefix' => env('SQS_PREFIX', 'https://sqs.us-west-2.amazonaws.com/1234567890'),
58+
'queue' => env('SQS_QUEUE', 'stripe-webhooks'),
59+
'region' => env('AWS_DEFAULT_REGION', 'us-west-2'),
5860
],
5961
]
6062
```
@@ -78,7 +80,7 @@ class ExampleController extends Controller
7880
{
7981
// Create a PHP object
8082
$object = [
81-
'music' => 'Sample message',
83+
'music' => 'Sample SQS message',
8284
'time' => time()
8385
];
8486

@@ -109,15 +111,18 @@ handler in the config file and implement a handler class as follows:
109111
```php
110112
use Illuminate\Contracts\Queue\Job as LaravelJob;
111113

112-
class HandlerJob extends Job
114+
class SqsHandlerJob extends Job
113115
{
116+
/**
117+
* @var null|array $data
118+
*/
114119
protected $data;
115120

116121
/**
117122
* @param LaravelJob $job
118-
* @param array $data
123+
* @param null|array $data
119124
*/
120-
public function handle(LaravelJob $job, array $data)
125+
public function handle(LaravelJob $job, ?array $data): void
121126
{
122127
// This is incoming JSON payload, already decoded to an array
123128
var_dump($data);

config/sqs-queue-reader.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
* Separate queue handle with corresponding queue name as key.
1010
*/
1111
'handlers' => [
12-
'st-webhooks' => App\Jobs\SqsHandler::class,
12+
//'stripe-webhooks' => App\Jobs\StripeHandler::class,
13+
//'mailgun-webhooks' => App\Jobs\MailgunHandler::class,
14+
//'shopify-webhooks' => App\Jobs\ShopifyHandler::class,
1315
],
1416

1517
'default-handler' => App\Jobs\SqsHandler::class

0 commit comments

Comments
 (0)