Giter Site home page Giter Site logo

omarfawzi / rabbitmq-consumer-generator-bundle Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 31 KB

An extension bundle for php-amqplib/rabbitmq-bundle for dynamically generating consumers

License: MIT License

PHP 99.60% Makefile 0.40%
rabbitmq rabbitmq-consumer php symfony-bundle symfony4 php-amqplib php-amqp

rabbitmq-consumer-generator-bundle's Introduction

RabbitMQ Consumer Generator Bundle

Software License Latest Stable Version Total Downloads

Install

Via Composer

$ composer require edfa3ly-backend/rabbitmq-bundle-consumer-generator

Description

  • An extension bundle for php-amqplib/rabbitmq-bundle that generates consumers dynamically over code , converts them to their yaml representation and writes them over your specified path.

Usage

  • Inject the GeneratorWrapper in a service of your own creation and use its methods
class ServiceExample
{  

    /** @var GeneratorWrapper $wrapper */
    protected $wrapper;
   
   /**
    * ServiceExample constructor.
    *
    * @param GeneratorWrapper $wrapper
    */
   public function __construct(
       GeneratorWrapper $wrapper
   ) {
       $this->wrapper         = $wrapper;
   }
   
   /**
    * @throws Exception
    */
   public function createConsumers()
   {
       $consumer = new ConsumerSkeleton() ;
       $consumer->setName('the name of your consumer');
       $consumer->setQueueRoutingKeys(['array of routing keys of your consumer']);
       $consumer->setExchangeType('fanout , direct , topic or headers');
       $consumer->setExchangeName('the name of your consumer's exchange');
       $consumer->setQueueName('Queue name');
       $consumer->setCallback('\path\to\your\consumer\callback::class');
       $consumer->setAmqpConsumerType('consumers or batch_consumers');
       
       $this->wrapper->writeConsumers( [$consumer], 'relative\path\to\your\consumers\yaml');
   }
}

Console

Now you can generate consumers through command just run php bin\console consumer:generate and answer the prompted questions .

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

rabbitmq-consumer-generator-bundle's People

Contributors

omarfawzi avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.