GithubHelp home page GithubHelp logo

wlogic / rabbitmqsynchronizerbundle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from griffc/rabbitmqsynchronizerbundle

0.0 7.0 0.0 106 KB

This Bundle overrides some services of the RabbitMqBundle, so it behave synchronously, enabling easy functional testing.

PHP 97.07% Gherkin 2.93%

rabbitmqsynchronizerbundle's Introduction

RabbitMqSychronizerBundle

Build Status Scrutinizer Code Quality

About

When using asynchronous messaging system such as RabbitMQ, it's rather difficult to use functional tests to see if your messages are correctly published and consumed, and test the overall behaviour of your application.

This bundle tranforms the RabbitMq broker provided by the RabbitMqBundle into a Symfony2 synchronous event dispatcher, thus enabling easy testing, using functional test frameworks (such as Behat).

Installation

Require the bundle in you composer.json file :

{
    require-dev: {
        "kimlai/rabbitmq-synchronizer-bundle": "*@dev"
    }
}

Register the bundle :

//app/AppKernel.php

public function registerBundles()
{
    if (in_array($this->getEnvironment(), array('dev', 'test'))) {
        $bundles[] = new Lrqdo\Bundle\RabbitMqSynchronizerBundle\LrqdoRabbitMqSynchronizerBundle();
    }
}

Install the bundle :

$ php composer.phar update kimlai/rabbitmq-synchronizer-bundle

Usage

You don't need to change anything in you rabbitmq config, you can keep using Producers and Consumers just like you did before.

When you're running you app in the dev or test environment, the bundle will create a new service named lrqdo.rabbitmq-synchronizer.broker. This is the service that replaces the actual RabbitMQ broker.

Then it looks for all services with the tags old_sound_rabbit_mq.producer or old_sound_rabbit_mq.consumer, and replaces them with custom instances, providing all the necesary plumbing so that the app behaves exactly like it did before, only in a synchronous way.

Once this is done, when your producers publish messages on a topic, the consumers are executed synchronously from within Symfony, just like any EventListener.

Tests

This bundle is tested with behat. The tests are located the features/ folder.

To run the test suite :

$ ./vendor/bin/behat

rabbitmqsynchronizerbundle's People

Contributors

jumblesale avatar kimlai avatar nchagrass avatar nclavaud avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  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.