2017 © Pedro Peláez
 

library symfony-messenger-redis

Redis adapater for the symfony/messenger component

image

soyuka/symfony-messenger-redis

Redis adapater for the symfony/messenger component

  • Wednesday, May 23, 2018
  • by soyuka
  • Repository
  • 2 Watchers
  • 5 Stars
  • 889 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 13 Versions
  • 17 % Grown

The README.md

Redis adapter for symfony/messenger

Build Status, (*1)

Hello! This bundle is deprecated as symfony has now a Redis transport. It's available since symfony 4.3.0-BETA1, (*2)

This is an experimental Receiver/Sender on Redis for the symfony/messenger component., (*3)

Quick start

For now we're exposing a bundle which is pre-configuring the Messenger component with receivers and senders., (*4)

composer require symfony/messenger soyuka/symfony-messenger-redis

Add the bundle new Soyuka\RedisMessengerAdapter\Bundle\RedisMessengerAdapterBundle()., (*5)

Also requires the redis extension., (*6)

Add the following configuration:, (*7)

redis_messenger_adapter:
    messages:
        'App\Message\Foo': 'foo_queue'

Add a message handler:, (*8)

<?php

namespace App\MessageHandler;

use App\Message\Foo;

final class FooHandler
{
    public function __invoke(Foo $message)
    {
    }
}

Tag it:, (*9)

services:
  App\MessageHandler\FooHandler:
      tags:
          - { name: messenger.message_handler }

You're done!, (*10)

Launch bin/console messenger:consume-messages redis_messenger.receiver.foo_queue and dispatch messages from the bus:, (*11)

<?php
$bus->dispatch(new Foo());

Configuration reference

redis_messenger_adapter:
    redis:
        url: '127.0.0.1'
        port: 6379
        serializer: !php/const \Redis::SERIALIZER_IGBINARY # default is \Redis::SERIALIZER_PHP
    messages:
        'App\Message\Foo': 'foo_queue'
        'App\Message\Bar':
            queue: 'bar_queue'
            ttl: 10000
            blockingTimeout: 1000

Internals

Relevant discussion: https://twitter.com/jderusse/status/980768426116485122, (*12)

The sender uses a List and uses RPUSH (add value to the tail of the list). The receiver uses BRPOPLPUSH which reads the last element of the list and adds in to the head of another list (queue_processing). If no elements are present it'll block the connection until a new element shows up or the timeout is reached. When timeout is reached it works like a "ping" of some sort (todo wait for 26632 to be merged and $handle(null)). On every iteration, we will check the queue_processing list. For every items in this queue we have a corresponding key in redis with a given ttl. If the key has expired, the item is LREM (removed) from queue_processing and put back in the origin queue to be processed again. This workaround helps avoiding lost messages., (*13)

I started a RedisAdapter and may add it to symfony once messenger documentation and AMQP adapter are merged., (*14)

  • https://github.com/symfony/symfony/pull/26632 (AMQP adapter PR)
  • https://github.com/symfony/symfony-docs/pull/9437 (messenger documentation)
  • https://github.com/symfony/symfony/tree/master/src/Symfony/Component/Messenger (messenger component code)

The Versions

23/05 2018

dev-master

9999999-dev

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

23/05 2018

1.0.10

1.0.10.0

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

18/05 2018

1.0.9

1.0.9.0

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

18/04 2018

1.0.8

1.0.8.0

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

17/04 2018

1.0.7

1.0.7.0

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

12/04 2018

1.0.6

1.0.6.0

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

05/04 2018

1.0.5

1.0.5.0

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

05/04 2018

1.0.4

1.0.4.0

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

05/04 2018

1.0.3

1.0.3.0

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

04/04 2018

1.0.2

1.0.2.0

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

04/04 2018

dev-working

dev-working

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

04/04 2018

1.0.1

1.0.1.0

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka

30/03 2018

1.0.0

1.0.0.0

Redis adapater for the symfony/messenger component

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-redis *

 

The Development Requires

by Avatar soyuka