mariano / disque-php

PHP library for Disque, an in-memory, distributed job queue
MIT License
132 stars 19 forks source link

You cannot connect even with redis. There is not enough documentation on it #54

Closed msaraac closed 5 years ago

msaraac commented 7 years ago

Fatal error: Uncaught Error: Call to undefined method Disque\Connection\Predis::queue() in /Users/msarac/Desktop/Projects/social-project/src/Queue/Queue.php:35 Stack trace: #0 /Users/msarac/Desktop/Projects/social-project/public/index.php(54): Queue\Queue::connect() #1 {main} thrown in /Users/msarac/Desktop/Projects/social-project/src/Queue/Queue.php on line 35

public static function connect()
    {
        if(self::$connection == null)
        {
            $node = [
                new Credentials('159.89.5.229','6379','*******')
            ];
            $connectionFactory = new PredisFactory();
            $client = new Client($node);
            $client->getConnectionManager()->setConnectionFactory($connectionFactory);
            $client->queue('ali')->push(new Job(['ali' => 'veli']));
        }
    }
msaraac commented 7 years ago

Uncaught Disque\Connection\ConnectionException: No servers available in /Users/msarac/Desktop/Projects/social-project/vendor/mariano/disque-php/src/Connection/Manager.php:228 Stack trace: #0 /Users/msarac/Desktop/Projects/social-project/vendor/mariano/disque-php/src/Connection/Manager.php(173): Disque\Connection\Manager->findAvailableConnection() #1 /Users/msarac/Desktop/Projects/social-project/vendor/mariano/disque-php/src/Client.php(135): Disque\Connection\Manager->connect() #2 /Users/msarac/Desktop/Projects/social-project/vendor/mariano/disque-php/src/Queue/Queue.php(189): Disque\Client->connect() #3 /Users/msarac/Desktop/Projects/social-project/vendor/mariano/disque-php/src/Queue/Queue.php(105): Disque\Queue\Queue->checkConnected() #4 /Users/msarac/Desktop/Projects/social-project/src/Queue/Queue.php(36): Disque\Queue\Queue->push(Object(Disque\Queue\Job)) #5 /Users/msarac/Desktop/Projects/social-project/public/index.php(54): Queue\Queue::connect() #6 {main} thrown in /Users/msarac/Desktop/Projects/social-project/vendor/mariano/disque-php/src/Connection/Manager.php on line 228

Revisor commented 6 years ago

Hello, this happened, because the code was not able to connect to the server whose credentials you provided.

Does the code have access to the IP address 159.89.5.229? Is Disque really running there? Is the port and the password correct?