Currently, ZfrEbWorker makes it very easy to work with Beanstalk worker, but it does not have any way to easily pull messages locally for development.
I'd suggest that we add a CLI command - maybe Symfony CLI ? - (ideally that could be launched using something like "composer eb-worker", although I'm not sure about how to do that).
It should accept two options:
server: the server to push messages from (it will likely be "localhost" or the IP of the local Docker container)
queue: the queue name
So it would be launched like this: composer eb-worker --server localhost:8000 --queue my-sqs-queue
Currently, ZfrEbWorker makes it very easy to work with Beanstalk worker, but it does not have any way to easily pull messages locally for development.
I'd suggest that we add a CLI command - maybe Symfony CLI ? - (ideally that could be launched using something like "composer eb-worker", although I'm not sure about how to do that).
It should accept two options:
So it would be launched like this:
composer eb-worker --server localhost:8000 --queue my-sqs-queue
The command will:
getQueueUrl
to get the complete queue URL (https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-sqs-2012-11-05.html#getqueueurl)receiveMessage
(https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-sqs-2012-11-05.html#receivemessage) and push each message to the specified URL + "/internal/worker" (as this is the default route for EbWorker).We can introduce
GuzzleHttp
dependency as a dev-dependancy to make the HTTP call. We must make sure to add all the required headers that Beanstalk add by default (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-tiers.html#worker-environ).@danizord could you do that one?