HttpClientInterfaceinterface was added andRestConfigurableProducerimplements it via theUsesGuzzleHttpClienttrait. The interface adds an extra functionaddHandler()that allows users to add extra Handlers to theClientInterface. By default a new handler is added (Smartbox\Integration\FrameworkBundle\Components\WebService\Rest\Middleware) while building the container fixing an bug in Guzzle that incorrectly splits multibyte charaters in two when truncating the response body. If you're already tweaking the Guzzle client used by the RestConfigurableProducer, you'll have to check if this new handler overrides it.
The AMQP driver was revamped to use the php-amqplib library instead of the PHP's built-in AMQP functions. The reason behind this was to take advantage of the non-blocking consume() function of this library, which the native driver doesn't support. Now the AMQP driver does not ignore posix signals bringing the possibility to stop the consumer gracefully with kill -s INT {pid}. To facilitate this feature, now the consumer name in AMQP shows the PID number as the last part of the name.
Naturally, now the php-amqplib is a dev-dependency of this bundle and a hard dependency of your project if you plan to use AMQP.
timeoutwas renamed toread_timeout. If you use the heartbeat feature, the recommended value is 2 times the configured heartbeat value.connection_timeoutwas added to work with both drivers. The default value is 30 seconds.prefetch_countwas added. STOMP defaults to 1 (and currently only supports that value) and AMQP to 10.hearbeatwas added and defaults to 60 seconds. Available only for the AMQP driver.connectionswas removed. Usehostnameinstead.
queue_consumerswas added to configure the consumers. For a consumer, the following can be configured:typedetermines which type of consumer is going to be used (possible values aresyncorasync).decoding_exception_handlerdetermines which exception handler should be used if a message can't be decoded. By defaultReThrowExceptionHandleris used.
default_queue_consumerwas added. Set your default queue consumer with this key. Useful to switch from STOMP to AMQP if you're already using this bundle.
-
To accommodate the async nature of AMQP,
QueueDriverInterfacewas heavily modified and two new interfaces extend it:SyncQueueDriverInterfaceandAsyncQueueDriverInterface. STOMP uses the former and AMQP the latter. Functions strictly related to STOMP or synchronous drivers were moved to theSyncQueueDriverInterface(i.e.:subscribe(),receive()). -
Signatures for the
QueueDriverInterfacevary slightly from the original implementation:format(i.e.:json) was removed from theconfigure()function and it was replaced byvhost(string).
-
PurgableQueueDriverInterfacewas removed. -
AmqpQueueHandlerandQueueManagerwere removed. -
QueueMessagenow includes an extra property calledmessageId. This is used to keep track of which message needs to beack-ed in the broker.QueueMessageInterfacewas updated as well.
QueueDriverConnectionSmokeTestwill now insert a message into theisalivequeue with a queue TTL of 1 second (via thex-message-ttlheader). Depending on your DLX configuration, you might need to exclude this queue from the exchange's policy to prevent polluting the queue where your DLX inserts dead messages.
- PHP's
ext-socketsis now a requirement of this bundle, due tophp-amqplibrequiring it.
- The original
ExceptionHandlerfor poisoned messages was renamed toDecodingExceptionHandlerand gives the consumer a chance to fix the message. The default behaviour remains rethrowing the exception, but if you have a custom handler, now you can return a newMessageInterfaceand continue the processing of the message. - Instead of using
__invoke(), DecodingExceptionHandlers must implement thehandle()function and return a newMessageInterface,nullor throw an exception.
- The responsibility to serialize and deserialize a message has been decoupled from the driver to a new service that implements
QueueSerializerInterface. - This new service is configured with JMS serializer to
serializeanddeserializemessages and aformatthat by default is configured tojson. - This service is injected in the
QueueProducer,QueueConsumerandAsyncQueueConsumerand has the responsibility toencode(prepare the message for what the driver expects) anddecode(prepare the message received from the broker to what the consumer expects) messages.
QueueDriverInterfacewas modified to decouple the serialization responsibility. Now the driver only accepts a string, instead of aQueueMessage. To achieve this, thesend()function signature was changed to accept adestination,body(serialized payload), andheaders.- The signature of the
receive()function has been changed to return aSmartbox\Integration\FrameworkBundle\Core\Dtos\Messageinstead of aQueueMessage. - The function
createQueueMessage()has been moved from the driver to theQueueProducer