Skip to content

[READ-ONLY]A Queue Job component base on hyperf/amqp.

License

Notifications You must be signed in to change notification settings

friendsofhyperf/amqp-job

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Amqp Job

Latest Stable Version Total Downloads License

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
{
    //
}

Contact

License

MIT

About

[READ-ONLY]A Queue Job component base on hyperf/amqp.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages