16 KiB
16 KiB
CHANGELOG
6.4
- Deprecate
StopWorkerOnSignalsListenerin favor of using theSignalableCommandInterface - Add
HandlerDescriptor::getOptions - Add support for multiple Redis Sentinel hosts
- Add
--alloption to themessenger:failed:removecommand - Add
WrappedExceptionsInterfaceinterface for exceptions that hold multiple individual exceptions - Deprecate
HandlerFailedException::getNestedExceptions(),HandlerFailedException::getNestedExceptionsOfClass()andDelayedMessageHandlingException::getExceptions()which are replaced by a newgetWrappedExceptions()method
6.3
- Add support for namespace wildcards in the HandlersLocator to allow routing multiple messages within the same namespace
- Deprecate
Symfony\Component\Messenger\Transport\InMemoryTransportandSymfony\Component\Messenger\Transport\InMemoryTransportFactoryin favor ofSymfony\Component\Messenger\Transport\InMemory\InMemoryTransportandSymfony\Component\Messenger\Transport\InMemory\InMemoryTransportFactory - Allow passing a string instead of an array in
TransportNamesStamp - Allow to define batch size when using
BatchHandlerTraitwithgetBatchSize() - Deprecate
StopWorkerOnSigtermSignalListenerin favor ofStopWorkerOnSignalsListenerand make it configurable with SIGINT and SIGTERM by default - Add
RedispatchMessageandRedispatchMessageHandler - Add optional parameter
$isSameDatabasetoDoctrineTransport::configureSchema()
6.2
- Add new
messenger:statscommand that returns a list of transports with their "to be processed" message count - Add
TransportNamesStampto change the transport while dispatching a message - Add support for rate limited transports by using the RateLimiter component.
- Deprecate
MessageHandlerInterfaceandMessageSubscriberInterface, use#[AsMessageHandler]instead - Add new parameter
allowNoSenderstoSendMessageMiddlewareto enable throwing when a message doesn't have a sender
6.1
- Add
SerializedMessageStampto avoid serializing a message when a retry occurs - Automatically resolve handled message type when method different from
__invokeis used as handler - Allow
#[AsMessageHandler]attribute on methods
6.0
- Remove deprecated classes
Symfony/Component/Messenger/Transport/AmqpExt,Symfony/Component/Messenger/Transport/DoctrineandSymfony/Component/Messenger/Transport/Redis. - Class
MessengerPasscannot be configured with constructor arguments - Remove constructor arguments and getters for
RedeliveryStamp's propertiesexceptionMessageandflattenException
5.4
- Add
AsMessageHandlerattribute for declaring message handlers on PHP 8. - Add support for handling messages in batches with
BatchHandlerInterfaceand corresponding trait - Add
StopWorkerExceptionInterfaceand its implementationStopWorkerExceptionto stop the worker. - Add support for resetting container services after each messenger message.
- Added
WorkerMetadataclass which allows you to access the configuration details of a worker, likequeueNamesandtransportNamesit consumes from. - New method
getMetadata()was added toWorkerclass which returns theWorkerMetadataobject. - Deprecate not setting the
reset_on_messageconfig option, its default value will change totruein 6.0 - Add log when worker should stop.
- Add log when
SIGTERMis received. - Add
--statsand--class-filteroptions toFailedMessagesShowCommand
5.3
- Add the
RouterContextMiddlewareto restore the original router context when handling a message InMemoryTransportcan perform message serialization through dsnin-memory://?serialize=true.- Added
queuesoption toWorkerto only fetch messages from a specific queue from a receiver implementingQueueReceiverInterface.
5.2.0
- The
RedeliveryStampwill no longer be populated with error data. This information is now stored in theErrorDetailsStampinstead. - Added
FlattenExceptionNormalizerto give more information about the exception on Messenger background processes. TheFlattenExceptionNormalizerhas a higher priority thanProblemNormalizerand it is only used when the Messenger serialization context is set. - Added factory methods
DelayStamp::delayFor(\DateInterval)andDelayStamp::delayUntil(\DateTimeInterface). - Removed the exception when dispatching a message with a
DispatchAfterCurrentBusStampand not in a context of another dispatch call - Added
WorkerMessageRetriedEvent
5.1.0
- Moved AmqpExt transport to package
symfony/amqp-messenger. All classes inSymfony\Component\Messenger\Transport\AmqpExthave been moved toSymfony\Component\Messenger\Bridge\Amqp\Transport - Moved Doctrine transport to package
symfony/doctrine-messenger. All classes inSymfony\Component\Messenger\Transport\Doctrinehave been moved toSymfony\Component\Messenger\Bridge\Doctrine\Transport - Moved RedisExt transport to package
symfony/redis-messenger. All classes inSymfony\Component\Messenger\Transport\RedisExthave been moved toSymfony\Component\Messenger\Bridge\Redis\Transport - Added support for passing a
\Throwableargument toRetryStrategyInterfacemethods. This allows to define strategies based on the reason of the handling failure. - Added
StopWorkerOnFailureLimitListenerto stop the worker after a specified amount of failed messages is reached. - Added
RecoverableExceptionInterfaceinterface to force retry.
5.0.0
- The
LoggingMiddlewareclass has been removed, pass a logger toSendMessageMiddlewareinstead. - made
SendersLocatorrequire aContainerInterfaceas 2nd argument
4.4.0
- Added support for auto trimming of Redis streams.
InMemoryTransporthandle acknowledged and rejected messages.- Made all dispatched worker event classes final.
- Added support for
from_transportattribute onmessenger.message_handlertag. - Added support for passing
dbindexas a query parameter to the redis transport DSN. - Added
WorkerStartedEventandWorkerRunningEvent - [BC BREAK] Removed
SendersLocatorInterface::getSenderByAliasadded in 4.3. - [BC BREAK] Removed
$retryStrategiesargument fromWorker::__construct. - [BC BREAK] Changed arguments of
ConsumeMessagesCommand::__construct. - [BC BREAK] Removed
$senderClassOrAliasargument fromRedeliveryStamp::__construct. - [BC BREAK] Removed
UnknownSenderException. - [BC BREAK] Removed
WorkerInterface. - [BC BREAK] Removed
$onHandledCallbackofWorker::run(array $options = [], callable $onHandledCallback = null). - [BC BREAK] Removed
StopWhenMemoryUsageIsExceededWorkerin favor ofStopWorkerOnMemoryLimitListener. - [BC BREAK] Removed
StopWhenMessageCountIsExceededWorkerin favor ofStopWorkerOnMessageLimitListener. - [BC BREAK] Removed
StopWhenTimeLimitIsReachedWorkerin favor ofStopWorkerOnTimeLimitListener. - [BC BREAK] Removed
StopWhenRestartSignalIsReceivedin favor ofStopWorkerOnRestartSignalListener. - The component is not marked as
@experimentalanymore. - Marked the
MessengerDataCollectorclass as@final. - Added support for
DelayStampto theredistransport.
4.3.0
- Added
NonSendableStampInterfacethat 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. - [BC BREAK]
SendersLocatorInterfacehas an additional method:getSenderByAlias(). - Removed argument
?bool &$handle = falsefromSendersLocatorInterface::getSenders - A new
ListableReceiverInterfacewas added, which a receiver can implement (when applicable) to enable listing and fetching individual messages by id (used in the new "Failed Messages" commands). - Both
SenderInterface::send()andReceiverInterface::get()should now (when applicable) add aTransportMessageIdStamp. - Added
WorkerStoppedEventdispatched when a worker is stopped. - Added optional
MessageCountAwareInterfacethat receivers can implement to give information about how many messages are waiting to be processed. - [BC BREAK] The
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. - [BC BREAK] The
MessageBusInterface::dispatch()signature changed: a second argumentarray $stamps = []was added. - Added new
messenger:stop-workerscommand that sends a signal to stop allmessenger:consumeworkers. - [BC BREAK] The
TransportFactoryInterface::createTransport()signature changed: a required 3rdSerializerInterfaceargument was added. - Added a new
SyncTransportto explicitly handle messages synchronously. - Added
AmqpStampallowing to provide a routing key, flags and attributes on message publishing. - [BC BREAK] Removed publishing with a
routing_keyoption from queue configuration, for AMQP. Use exchangedefault_publish_routing_keyorAmqpStampinstead. - [BC BREAK] Changed the
queueoption in the AMQP transport DSN to bequeues[name]. You can therefore name the queue but also configurebinding_keys,flagsandarguments. - [BC BREAK] The methods
get,ack,nackandqueueof the AMQPConnectionhave a new argument: the queue name. - Added optional parameter
prefetch_countin connection configuration, to setup channel prefetch count. - New classes:
RoutableMessageBus,AddBusNameStampMiddlewareandBusNameStampwere added, which allow you to add a bus identifier to theEnvelopethen find the correct bus when receiving from the transport. SeeConsumeMessagesCommand. - The optional
$busNamesconstructor argument of the classConsumeMessagesCommandwas removed. - [BC BREAK] 3 new methods were added to
ReceiverInterface:ack(),reject()andget(). The methodsreceive()andstop()were removed. - [BC BREAK] Error handling was moved from the receivers into
Worker. Implementations ofReceiverInterface::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. - [BC BREAK]
RejectMessageExceptionInterfacewas removed and replaced bySymfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException, which has the same behavior: a message will not be retried - The default command name for
ConsumeMessagesCommandwas changed frommessenger:consume-messagestomessenger:consume ConsumeMessagesCommandhas two new optional constructor arguments- [BC BREAK] The first argument to Worker changed from a single
ReceiverInterfaceto an array ofReceiverInterface. Workerhas 3 new optional constructor arguments.- The
Workerclass now handles callingpcntl_signal_dispatch()the receiver no longer needs to call this. - The
AmqpSenderwill now retry messages using a dead-letter exchange and delayed queues, instead of retrying vianack() - Senders now receive the
Envelopewith theSentStampon it. Previously, theEnvelopewas passed to the sender and then theSentStampwas added. SerializerInterfaceimplementations should now throw aSymfony\Component\Messenger\Exception\MessageDecodingFailedExceptionifdecode()fails for any reason.- [BC BREAK] The default
Serializerwill now throw aMessageDecodingFailedExceptionifdecode()fails, instead of the underlying exceptions from the Serializer component. - Added
PhpSerializerwhich uses PHP's nativeserialize()andunserialize()to serialize messages to a transport - [BC BREAK] If no serializer were passed, the default serializer
changed from
SerializertoPhpSerializerinsideAmqpReceiver,AmqpSender,AmqpTransportandAmqpTransportFactory. - Added
TransportExceptionto mark an exception transport-related - [BC BREAK] If listening to exceptions while using
AmqpSenderorAmqpReceiver,\AMQPExceptionis no longer thrown in favor ofTransportException. - Deprecated
LoggingMiddleware, pass a logger toSendMessageMiddlewareinstead. - [BC BREAK]
Connection::__construct()andConnection::fromDsn()both no longer have$isDebugarguments. - [BC BREAK] The Amqp Transport now automatically sets up the exchanges
and queues by default. Previously, this was done when in "debug" mode
only. Pass the
auto_setupconnection option to control this. - Added a
SetupTransportsCommandcommand to setup the transports - Added a Doctrine transport. For example, use the
doctrine://defaultDSN (this uses thedefaultDoctrine entity manager) - [BC BREAK] The
getConnectionConfigurationmethod on Amqp'sConnectionhas been removed. - [BC BREAK] A
HandlerFailedExceptionexception will be thrown if one or more handler fails. - [BC BREAK] The
HandlersLocationInterface::getHandlersmethod needs to returnHandlerDescriptorinstances instead of callables. - [BC BREAK] The
HandledStampstamp has changed:handlerAliashas been renamed tohandlerName,getCallableNamehas been removed and its constructor only has 2 arguments now. - [BC BREAK] The
ReceivedStampneeds to exposes the name of the transport from which the message has been received.
4.2.0
- Added
HandleTraitleveraging a message bus instance to return a single synchronous message handling result - Added
HandledStamp&SentStampstamps - All the changes below are BC BREAKS
- Senders and handlers subscribing to parent interfaces now receive all matching messages, wildcard included
MessageBusInterface::dispatch(),MiddlewareInterface::handle()andSenderInterface::send()returnEnvelopeMiddlewareInterface::handle()now require anEnvelopeas first argument and aStackInterfaceas secondEnvelopeAwareInterfacehas been removed- The signature of
Amqp*classes changed to take aConnectionas a first argument and an optionalSerializeras 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.StampInterfacereplacesEnvelopeItemInterfaceand doesn't extendSerializableanymore- The
ConsumeMessagesCommandclass now takes an instance ofPsr\Container\ContainerInterfaceas first constructor argument - The
EncoderInterfaceandDecoderInterfacehave been replaced by a unifiedSymfony\Component\Messenger\Transport\Serialization\SerializerInterface. - Renamed
EnvelopeItemInterfacetoStampInterface Envelope's constructor andwith()method now acceptStampInterfaceobjects as variadic parameters- Renamed and moved
ReceivedMessage,ValidationConfigurationandSerializerConfigurationin theStampnamespace - Removed the
WrapIntoReceivedMessageclass MessengerDataCollector::getMessages()returns an iterable, not just an array anymoreHandlerLocatorInterface::resolve()has been removed, useHandlersLocator::getHandlers()insteadSenderLocatorInterface::getSenderForMessage()has been removed, useSendersLocator::getSenders()instead- Classes in the
Middleware\Enhancerssub-namespace have been moved to theMiddlewareone - Classes in the
Asynchronous\Routingsub-namespace have been moved to theTransport\Sender\Locatorsub-namespace - The
Asynchronous/Middleware/SendMessageMiddlewareclass has been moved to theMiddlewarenamespace SenderInterfacehas been moved to theTransport\Sendersub-namespace- The
ChainHandlerandChainSenderclasses have been removed ReceiverInterfaceand its implementations have been moved to theTransport\Receiversub-namespaceActivationMiddlewareDecoratorhas been renamedActivationMiddlewareAllowNoHandlerMiddlewarehas been removed in favor of a new constructor argument onHandleMessageMiddleware- The
ContainerHandlerLocator,AbstractHandlerLocator,SenderLocatorandAbstractSenderLocatorclasses have been removed Envelope::all()takes a new optional$stampFqcnargument and returns the stamps for the specified FQCN, or all stamps by their class nameEnvelope::get()has been renamedEnvelope::last()
4.1.0
- Introduced the component as experimental