friendsofhyperf / amqp-job
The amqp job for Hyperf.
Fund package maintenance!
huangdijia
hdj.me/sponsors
Installs: 5 632
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
pkg:composer/friendsofhyperf/amqp-job
Requires
- friendsofhyperf/support: ~3.2.0
- hyperf/amqp: ~3.2.0
- hyperf/codec: ~3.2.0
- hyperf/conditionable: ~3.2.0
- hyperf/config: ~3.2.0
- hyperf/context: ~3.2.0
- hyperf/di: ~3.2.0
- hyperf/logger: ~3.2.0
- hyperf/redis: ~3.2.0
- hyperf/support: ~3.2.0
- 3.2.x-dev
- v3.2.0-alpha.1
- dev-main / 3.1.x-dev
- v3.1.69
- v3.1.67
- v3.1.64
- v3.1.48
- v3.1.45
- v3.1.44
- v3.1.43
- v3.1.41
- v3.1.35.1
- v3.1.35
- v3.1.31
- v3.1.28.1
- v3.1.27
- v3.1.17
- v3.1.15
- v3.1.14
- v3.1.9
- v3.1.5
- v3.1.1
- v3.1.0
- v3.1.0-rc.4
- v3.1.0-rc.2
- v3.1.0-beta.20
- v3.1.0-beta.15
- v3.1.0-beta.13
- v3.1.0-beta.10
- v3.1.0-beta.9
This package is auto-updated.
Last update: 2025-11-02 01:56:54 UTC
README
The amqp job component for Hyperf.
Installation
composer require friendsofhyperf/amqp-job
Usage
Dispatch
use FriendsOfHyperf\AmqpJob\Job; use FriendsOfHyperf\AmqpJob\Annotations\AmqpJob; use function FriendsOfHyperf\AmqpJob\dispatch; #[AmqpJob( exchange: 'hyperf.exchange', routingKey: 'hyperf.routing.key', pool: 'default', queue: 'hyperf.queue', )] class FooJob extends Job { public function handle() { var_dump('foo'); } } dispatch(new FooJob());
Register Consumer[Optional]
namespace App\Amqp\Consumer; use FriendsOfHyperf\AmqpJob\JobConsumer; use Hyperf\Amqp\Annotation\Consumer; #[Consumer( exchange: 'hyperf.exchange', routingKey: 'hyperf.routing.key', queue: 'hyperf.queue', name: 'MyConsumer', nums: 4 )] class MyConsumer extends \FriendsOfHyperf\AmqpJob\JobConsumer { // }