Skip to content

Latest commit

 

History

History
64 lines (44 loc) · 1.38 KB

transport.md

File metadata and controls

64 lines (44 loc) · 1.38 KB

PHP Simple Queue Usage basics

Transport - provides methods for management messages in queue.

📖 Guide


Currently only supported Doctrine DBAL.


📄 Transport

The transport uses Doctrine DBAL library and SQL like server as a broker. It creates a table there. Pushes and pops messages to\from that table.


Create connection:

You can get a DBAL Connection through the Doctrine\DBAL\DriverManager class.

$connection = \Doctrine\DBAL\DriverManager::getConnection([
    'dbname' => 'my_db',
    'user' => 'root',
    'password' => '*******',
    'host' => 'localhost',
    'port' => '5432',
    'driver' => 'pdo_pgsql',
]);

or

$connection = \Doctrine\DBAL\DriverManager::getConnection([
    'driver' => 'pdo_sqlite',
    'path' => '/db/queue.db'
]);

See more information.


Create transport:

$transport = new \Simple\Queue\Transport\DoctrineDbalTransport($connection);