2017 © Pedro Peláez
 

symfony-bundle async

A bundle to handle serialization and deseralization of Entities on Symfony, it's a layer over Symfony's Serializer Component

image

aescarcha/async

A bundle to handle serialization and deseralization of Entities on Symfony, it's a layer over Symfony's Serializer Component

  • Wednesday, August 3, 2016
  • by aEscarcha
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Aescarcha AsyncBundle

Introduction

This bundle handles events on Symfony entities, like persist, delete... It pushes a job to RMQ so heavy stuff can be handled in an asynchronous way., (*1)

Install

composer require aescarcha/async

Config

Configure RMQ in your config.yml, IE:
old_sound_rabbit_mq:
    connections:
        default:
            host:     'localhost'
            port:     5672
            user:     'guest'
            password: 'guest'
            vhost:    '/'
            lazy:     false
            connection_timeout: 3
            read_write_timeout: 3

            # requires php-amqplib v2.4.1+ and PHP5.4+
            keepalive: false

            # requires php-amqplib v2.4.1+
            heartbeat: 0
    producers: #the process sending messages to the broker is called producer
        async_refresher:
            connection:       default
            exchange_options: {name: 'async-refresher', type: direct}

    consumers: #the process receiving those messages is called consumer
        async_refresher:
            connection:       default
            exchange_options: {name: 'async-refresher', type: direct}
            queue_options:    {name: 'async-refresher'}
            callback:         aescarcha.persist_listener

services.yml

#Listener to trigger async regeneration, this service is also a rabbit consumer
aescarcha.persist_listener:
    class: Aescarcha\ChallengeBundle\Listener\PersistListener
    arguments: [ @service_container ]
    tags:
        - { name: doctrine.event_listener, event: postPersist }
        - { name: doctrine.event_listener, event: postUpdate }
        - { name: doctrine.event_listener, event: postRemove }
        - { name: doctrine.event_listener, event: postSoftDelete }
AppKernel.php
$bundles = array(
    new Aescarcha\SerializerBundle\AescarchaSerializerBundle(),
);

Tests

Tests are provided on the repo, but they're not working because the test requires some Entities and Repositories to work, making them work in a clean symfony install is also a TODO, (*2)

SERIUS TODO:

Dynamic classes called on listeners, move those classes outside the repo, (*3)

The Versions

03/08 2016

dev-master

9999999-dev

A bundle to handle serialization and deseralization of Entities on Symfony, it's a layer over Symfony's Serializer Component

  Sources   Download

MIT

The Requires

 

The Development Requires

by Álvaro Escarcha

serialization symfony