Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add routing key to header for amqp custom serializer #43039

Closed
@jokaorgua

Description

@jokaorgua

Description
It would be very useful to have a routing key in custom messenger incoming data. Currently, there is no way to map message to type on the base on routing key

Example

class CustomSerializer implements SerializerInterface
{
    public function decode(array $encodedEnvelope): Envelope
    {
        $body = $encodedEnvelope['body'];
        $headers = $encodedEnvelope['headers'];
        $extra = $encodedEnvelope['extra'];
        $routingKey = $extra->routingKey;
        switch($routingKey)
       {
         case 'blah':
            $message = new Type1($body)...
       }
       .....
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions