Skip to content

Commit 4e2d883

Browse files
committed
Added more docs
1 parent c67b1ff commit 4e2d883

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
[![Total Downloads](https://img.shields.io/packagist/dt/palpalani/laravel-sqs-queue-json-reader.svg?style=flat-square)](https://packagist.org/packages/palpalani/laravel-sqs-queue-json-reader)
77

88

9-
Custom SQS queue reader for Laravel projects that supports raw JSON payloads and reads multiple messages.
10-
Laravel expects SQS messages to be generated in a
9+
Custom SQS queue reader for Laravel projects that supports raw JSON payloads and reads multiple messages. Laravel expects SQS messages to be generated in a
1110
specific format that includes job handler class and a serialized job.
1211

1312
Note: Implemented to read multiple messages from queue.
1413

15-
But in certain cases you may want to parse messages from 3rd party
16-
applications, custom JSON messages and so on.
14+
This library is very useful when you want to parse messages from 3rd party
15+
applications such as stripe webhooks, shopify webhooks, mailgun web hooks, custom JSON messages and so on.
1716

1817
## Installation
1918

@@ -44,7 +43,7 @@ return [
4443
],
4544
'mailgun-webhooks' => [
4645
'class' => App\Jobs\MailgunHandler::class,
47-
'count' => 100,
46+
'count' => 10,
4847
]
4948
],
5049

@@ -71,8 +70,8 @@ Add `sqs-json` connection to your config/queue.php, Ex:
7170
'driver' => 'sqs-json',
7271
'key' => env('AWS_ACCESS_KEY_ID', ''),
7372
'secret' => env('AWS_SECRET_ACCESS_KEY', ''),
74-
'prefix' => env('SQS_PREFIX', 'https://sqs.us-west-2.amazonaws.com/1234567890'),
75-
'queue' => env('SQS_QUEUE', 'stripe-webhooks'),
73+
'prefix' => env('AWS_SQS_PREFIX', 'https://sqs.us-west-2.amazonaws.com/1234567890'),
74+
'queue' => env('AWS_SQS_QUEUE', 'external-webhooks'),
7675
'region' => env('AWS_DEFAULT_REGION', 'us-west-2'),
7776
],
7877
]
@@ -97,7 +96,7 @@ class ExampleController extends Controller
9796
{
9897
// Dispatch job with some data.
9998
$job = new DispatcherJob([
100-
'music' => 'Sample SQS message',
99+
'music' => 'Ponni nathi from PS-1',
101100
'singer' => 'AR. Rahman',
102101
'time' => time()
103102
]);
@@ -130,17 +129,16 @@ For production, use supervisor with the following configuration.
130129

131130
```
132131
[program:sqs-json-reader]
133-
;process_name=%(program_name)s
134132
process_name=%(program_name)s_%(process_num)02d
135-
command=php /srv/app/artisan queue:work sqs-json --sleep=20 --timeout=50 --tries=2 --memory=128 --daemon
136-
directory=/srv/app
133+
command=php /var/html/app/artisan queue:work sqs-json --sleep=30 --timeout=50 --tries=2 --memory=128 --daemon
134+
directory=/var/html/app
137135
autostart=true
138136
autorestart=true
139137
startretries=10
140138
user=root
141139
numprocs=1
142140
redirect_stderr=true
143-
stdout_logfile=/srv/app/horizon.log
141+
stdout_logfile=/var/html/app/horizon.log
144142
stderr_logfile=/tmp/horizon-error.log
145143
stopwaitsecs=3600
146144
priority=1000
@@ -177,8 +175,12 @@ class SqsHandlerJob extends Job
177175
}
178176
```
179177

178+
For more information about AWS SQS check [offical docs](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-queue-parameters.html).
179+
180180
## Testing
181181

182+
We already configured the script, just run the command:
183+
182184
```bash
183185
composer test
184186
```

0 commit comments

Comments
 (0)