codin/thumper

RabbitMQ abstraction for queues and workers

Maintainers

Details

github.com/codin/thumper

Source

Issues

Installs: 2 188

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/codin/thumper

0.1.0 2022-03-22 03:02 UTC

This package is auto-updated.

Last update: 2025-09-22 10:22:50 UTC


README

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