Skip to content

codin/thumper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thumper

version workflow license

RabbitMQ abstraction for queues and workers.

Install

Via Composer

$ composer require codin/thumper

Examples

$connection = new PhpAmqpLib\Connection\AMQPLazyConnection('localhost', '5672', 'username', 'password');
$exchange = new Codin\Thumper\Config\Exchange('my-exchange-name', PhpAmqpLib\Exchange\AMQPExchangeType::DIRECT);

$producer = new Codin\Thumper\Producer($connection, $exchange);
$producer->publish('some message');
$connection = new PhpAmqpLib\Connection\AMQPLazyConnection('localhost', '5672', 'username', 'password');
$exchange = new Codin\Thumper\Config\Exchange('my-exchange-name', PhpAmqpLib\Exchange\AMQPExchangeType::DIRECT);

$queue = new Codin\Thumper\Config\Queue('my-queue-name');
$options = new Codin\Thumper\Config\Consumer($exchange, $queue);

$consumer = new Codin\Thumper\Consumer($connection, $options);

$callback = static function (PhpAmqpLib\Message\AMQPMessage $message): void {
    echo $message->getBody(); // some message
    $message->ack();
};
$consumer->consume($callback);

Testing

$ composer test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages