Configuring the Laravel 4.2 AWS SQS Queue Using the EB Workbench

I am trying to configure the Laravel 4.2 queue using AWS SQS and EB Worker. I queue a job from another server and want the production environment to execute it. But it still looks like the employee is trying to execute it, but for some reason gets an error 405 in the access log ...

I am trying to get a very simple test code ... On a working env. I pretty much clean up the Laravel installation only with the configuration of the queue and stuff, and this class:

class TestQueue {

    public function fire($job, $data)
    {
        File::append(storage_path().'/sqs_push.txt', $data['date']);

        $job->delete();
    }
}

Now on the main server, where I want to click from, I have this:

public function getTestQueue(){
    $data = ['date' => date('Y-m-d H:i:s')];
    $queue = \Queue::push('TestQueue', $data);
    var_dump($queue);
}

On working, I launched

php artisan queue:listen

, SQS ( SQS), , 405 ... , - ? - ?

+4
1

405 "MethodNotAllowed", . , SQS ( ), . GitHub. worker.php.

$queue = new Queue(QUEUE_NAME, unserialize(AWS_CREDENTIALS));

// Continuously poll queue for new messages and process them.
while (true) {
    $message = $queue->receive();
    if ($message) {
        try {
            $message->process();
            $queue->delete($message);
        } catch (Exception $e) {
            $queue->release($message);
            echo $e->getMessage();
        }
    } else {
        // Wait 20 seconds if no jobs in queue to minimise requests to AWS API
        sleep(20);
    }
}
0

Source: https://habr.com/ru/post/1588996/


All Articles