symfony / 4.1 / symfony / component / messenger / transport / serialization / encoderinterface.html

EncoderInterface

interface EncoderInterface

Methods

array encode(Envelope $envelope)

Encodes an envelope content (message & items) to a common format understandable by transports.

Details

array encode(Envelope $envelope)

Encodes an envelope content (message & items) to a common format understandable by transports.

The encoded array should only contain scalar and arrays.

The most common keys of the encoded array are: - body (string) - the message body - headers (string ) - a key/value pair of headers

Parameters

Envelope $envelope The envelop containing the message put on the MessageBus by the user

Return Value

array