amqp icon indicating copy to clipboard operation
amqp copied to clipboard

handling publish subscribe fanout

Open xtwoend opened this issue 3 years ago • 0 comments

hyperf is awesome framework but i have problem when using amqp on rabbitmq, when i want to use fanout in Publish/Subscribe implementation but when doing queue_declare queue name cannot be null.

/**
 * @Consumer(exchange="broadcast", routingKey="", queue="", name="SubribeMessage", nums=1)
 */
#[Consumer(exchange: 'broadcast', routingKey: '', queue: '', name: "SubribeMessage", nums: 1)]
class SubribeMessage extends ConsumerMessage
{
    protected $type = Type::FANOUT;

    public function consumeMessage($data, AMQPMessage $message): string
    {
        var_dump($data);
        return Result::ACK;
    }
}

 public function setQueue(string $queue): self
    {
        $this->queue = $queue;
        return $this;
    }

    public function getQueue(): string
    {
        return $this->queue;
    }

xtwoend avatar May 11 '22 13:05 xtwoend