AsMessageHandler
attribute for declaring message handlers on PHP 8.BatchHandlerInterface
and corresponding traitStopWorkerExceptionInterface
and its implementation StopWorkerException
to stop the worker.WorkerMetadata
class which allows you to access the configuration details of a worker, like queueNames
and transportNames
it consumes from.getMetadata()
was added to Worker
class which returns the WorkerMetadata
object.reset_on_message
config option, its default value will change to true
in 6.0SIGTERM
is received.RouterContextMiddleware
to restore the original router context when handling a messageInMemoryTransport
can perform message serialization through dsn in-memory://?serialize=true
.queues
option to Worker
to only fetch messages from a specific queue from a receiver implementing QueueReceiverInterface
.RedeliveryStamp
will no longer be populated with error data. This information is now stored in the ErrorDetailsStamp
instead.FlattenExceptionNormalizer
to give more information about the exception on Messenger background processes. The FlattenExceptionNormalizer
has a higher priority than ProblemNormalizer
and it is only used when the Messenger serialization context is set.DelayStamp::delayFor(\DateInterval)
and DelayStamp::delayUntil(\DateTimeInterface)
.DispatchAfterCurrentBusStamp
and not in a context of another dispatch callWorkerMessageRetriedEvent
WorkerMessageReceivedEvent::setEnvelope()
and made event mutablesymfony/amqp-messenger
. All classes in Symfony\Component\Messenger\Transport\AmqpExt
have been moved to Symfony\Component\Messenger\Bridge\Amqp\Transport
symfony/doctrine-messenger
. All classes in Symfony\Component\Messenger\Transport\Doctrine
have been moved to Symfony\Component\Messenger\Bridge\Doctrine\Transport
symfony/redis-messenger
. All classes in Symfony\Component\Messenger\Transport\RedisExt
have been moved to Symfony\Component\Messenger\Bridge\Redis\Transport
\Throwable
argument to RetryStrategyInterface
methods. This allows to define strategies based on the reason of the handling failure.StopWorkerOnFailureLimitListener
to stop the worker after a specified amount of failed messages is reached.RecoverableExceptionInterface
interface to force retry.LoggingMiddleware
class has been removed, pass a logger to SendMessageMiddleware
instead.SendersLocator
require a ContainerInterface
as 2nd argumentInMemoryTransport
handle acknowledged and rejected messages.from_transport
attribute on messenger.message_handler
tag.dbindex
as a query parameter to the redis transport DSN.WorkerStartedEvent
and WorkerRunningEvent
SendersLocatorInterface::getSenderByAlias
added in 4.3.$retryStrategies
argument from Worker::__construct
.ConsumeMessagesCommand::__construct
.$senderClassOrAlias
argument from RedeliveryStamp::__construct
.UnknownSenderException
.WorkerInterface
.$onHandledCallback
of Worker::run(array $options = [], callable $onHandledCallback = null)
.StopWhenMemoryUsageIsExceededWorker
in favor of StopWorkerOnMemoryLimitListener
.StopWhenMessageCountIsExceededWorker
in favor of StopWorkerOnMessageLimitListener
.StopWhenTimeLimitIsReachedWorker
in favor of StopWorkerOnTimeLimitListener
.StopWhenRestartSignalIsReceived
in favor of StopWorkerOnRestartSignalListener
.@experimental
anymore.MessengerDataCollector
class as @final
.DelayStamp
to the redis
transport.NonSendableStampInterface
that a stamp can implement if
it should not be sent to a transport. Transport serializers
must now check for these stamps and not encode them.SendersLocatorInterface
has an additional method:
getSenderByAlias()
.?bool &$handle = false
from SendersLocatorInterface::getSenders
ListableReceiverInterface
was added, which a receiver
can implement (when applicable) to enable listing and fetching
individual messages by id (used in the new "Failed Messages" commands).SenderInterface::send()
and ReceiverInterface::get()
should now (when applicable) add a TransportMessageIdStamp
.WorkerStoppedEvent
dispatched when a worker is stopped.MessageCountAwareInterface
that receivers can implement
to give information about how many messages are waiting to be processed.Envelope::__construct()
signature changed:
you can no longer pass an unlimited number of stamps as the second,
third, fourth, arguments etc: stamps are now an array passed to the
second argument.MessageBusInterface::dispatch()
signature changed:
a second argument array $stamps = []
was added.messenger:stop-workers
command that sends a signal
to stop all messenger:consume
workers.TransportFactoryInterface::createTransport()
signature
changed: a required 3rd SerializerInterface
argument was added.SyncTransport
to explicitly handle messages synchronously.AmqpStamp
allowing to provide a routing key, flags and attributes on message publishing.routing_key
option from queue configuration, for
AMQP. Use exchange default_publish_routing_key
or AmqpStamp
instead.queue
option in the AMQP transport DSN to be queues[name]
. You can
therefore name the queue but also configure binding_keys
, flags
and arguments
.get
, ack
, nack
and queue
of the AMQP Connection
have a new argument: the queue name.prefetch_count
in connection configuration,
to setup channel prefetch count.RoutableMessageBus
, AddBusNameStampMiddleware
and BusNameStamp
were added, which allow you to add a bus identifier
to the Envelope
then find the correct bus when receiving from
the transport. See ConsumeMessagesCommand
.$busNames
constructor argument of the class ConsumeMessagesCommand
was removed.ReceiverInterface
:
ack()
, reject()
and get()
. The methods receive()
and stop()
were removed.Worker
. Implementations of ReceiverInterface::handle()
should now allow all exceptions to be thrown, except for transport
exceptions. They should also not retry (e.g. if there's a queue,
remove from the queue) if there is a problem decoding the message.RejectMessageExceptionInterface
was removed and replaced
by Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException
,
which has the same behavior: a message will not be retriedConsumeMessagesCommand
was
changed from messenger:consume-messages
to messenger:consume
ConsumeMessagesCommand
has two new optional constructor argumentsReceiverInterface
to an array of ReceiverInterface
.Worker
has 3 new optional constructor arguments.Worker
class now handles calling pcntl_signal_dispatch()
the
receiver no longer needs to call this.AmqpSender
will now retry messages using a dead-letter exchange
and delayed queues, instead of retrying via nack()
Envelope
with the SentStamp
on it. Previously,
the Envelope
was passed to the sender and then the SentStamp
was added.SerializerInterface
implementations should now throw a
Symfony\Component\Messenger\Exception\MessageDecodingFailedException
if decode()
fails for any reason.Serializer
will now throw a
MessageDecodingFailedException
if decode()
fails, instead
of the underlying exceptions from the Serializer component.PhpSerializer
which uses PHP's native serialize()
and
unserialize()
to serialize messages to a transportSerializer
to PhpSerializer
inside AmqpReceiver
,
AmqpSender
, AmqpTransport
and AmqpTransportFactory
.TransportException
to mark an exception transport-relatedAmqpSender
or AmqpReceiver
, \AMQPException
is
no longer thrown in favor of TransportException
.LoggingMiddleware
, pass a logger to SendMessageMiddleware
instead.Connection::__construct()
and Connection::fromDsn()
both no longer have $isDebug
arguments.auto_setup
connection option to control this.SetupTransportsCommand
command to setup the transportsdoctrine://default
DSN (this uses the default
Doctrine entity manager)getConnectionConfiguration
method on Amqp's Connection
has been removed.HandlerFailedException
exception will be thrown if one or more handler fails.HandlersLocationInterface::getHandlers
method needs to return HandlerDescriptor
instances instead of callables.HandledStamp
stamp has changed: handlerAlias
has been renamed to handlerName
,
getCallableName
has been removed and its constructor only has 2 arguments now.ReceivedStamp
needs to exposes the name of the transport from which the message
has been received.HandleTrait
leveraging a message bus instance to return a single
synchronous message handling resultHandledStamp
& SentStamp
stampsMessageBusInterface::dispatch()
, MiddlewareInterface::handle()
and SenderInterface::send()
return Envelope
MiddlewareInterface::handle()
now require an Envelope
as first argument and a StackInterface
as secondEnvelopeAwareInterface
has been removedAmqp*
classes changed to take a Connection
as a first argument and an optional
Serializer
as a second argument.MessageSubscriberInterface::getHandledMessages()
return value has changed. The value of an array item
needs to be an associative array or the method name.StampInterface
replaces EnvelopeItemInterface
and doesn't extend Serializable
anymoreConsumeMessagesCommand
class now takes an instance of Psr\Container\ContainerInterface
as first constructor argumentEncoderInterface
and DecoderInterface
have been replaced by a unified Symfony\Component\Messenger\Transport\Serialization\SerializerInterface
.EnvelopeItemInterface
to StampInterface
Envelope
's constructor and with()
method now accept StampInterface
objects as variadic parametersReceivedMessage
, ValidationConfiguration
and SerializerConfiguration
in the Stamp
namespaceWrapIntoReceivedMessage
classMessengerDataCollector::getMessages()
returns an iterable, not just an array anymoreHandlerLocatorInterface::resolve()
has been removed, use HandlersLocator::getHandlers()
insteadSenderLocatorInterface::getSenderForMessage()
has been removed, use SendersLocator::getSenders()
insteadMiddleware\Enhancers
sub-namespace have been moved to the Middleware
oneAsynchronous\Routing
sub-namespace have been moved to the Transport\Sender\Locator
sub-namespaceAsynchronous/Middleware/SendMessageMiddleware
class has been moved to the Middleware
namespaceSenderInterface
has been moved to the Transport\Sender
sub-namespaceChainHandler
and ChainSender
classes have been removedReceiverInterface
and its implementations have been moved to the Transport\Receiver
sub-namespaceActivationMiddlewareDecorator
has been renamed ActivationMiddleware
AllowNoHandlerMiddleware
has been removed in favor of a new constructor argument on HandleMessageMiddleware
ContainerHandlerLocator
, AbstractHandlerLocator
, SenderLocator
and AbstractSenderLocator
classes have been removedEnvelope::all()
takes a new optional $stampFqcn
argument and returns the stamps for the specified FQCN, or all stamps by their class nameEnvelope::get()
has been renamed Envelope::last()