symfony-bundle amqp-bundle
AMQP client consumer Bundle for Symfony 3
m12u/amqp-bundle
AMQP client consumer Bundle for Symfony 3
- Saturday, July 15, 2017
- by dodev34
- Repository
- 1 Watchers
- 0 Stars
- 33 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 1 Open issues
- 2 Versions
- 94 % Grown
Command
$ bin/console m12u:amqp-stream:consumer --host=[HOST] --username=[USERNAME] --queue=[QUEUE] --port=[POST] <--vhost=[VHOST]> <--ssl>
Events availables
name |
Interfaces |
m12u.amqp.message |
M12U\Bundle\AmqpBundle\Event\AMQPMessageEventInterface |
Create listener
First step, create class, (*1)
<?php
namespace AppBundle\Listener;
use stdClass;
use M12U\Bundle\AmqpBundle\Event\AMQPMessageEventInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* Class AMQPMessageListener
* @package AppBundle\Listener
*/
class AMQPMessageListener
{
/**
* @param AMQPMessageEventInterface $event
*/
public function onM12uAmqpMessage(AMQPMessageEventInterface $event)
{
// exemple ...
$message = $event->getMessage();
switch ($event->getQueue())
{
case '1234567890987654321':
// todo ...
// operation on $message
break;
case '0987654321234567890':
// todo ...
// operation on $message
break;
}
}
}
Last step, declare service, (*2)
# app/config/services.yml
services:
AppBundle\Listener\AMQPMessageListener:
tags:
- { name: kernel.event_listener, event: m12u.amqp.message }
dev-master
9999999-dev
AMQP client consumer Bundle for Symfony 3
Sources
Download
MIT
The Requires
by
Michel Dourneau #m12u
1.0.0
1.0.0.0
AMQP client consumer Bundle for Symfony 3
Sources
Download
MIT
The Requires
by
Michel Dourneau #m12u