Skip to content

6.6.0

Compare
Choose a tag to compare
@dereuromark dereuromark released this 04 Jan 17:22
· 109 commits to master since this release

Improvements

Allow configuration of serializing strategy:

  • Object (default for BC) using legacy serialize()
  • JSON using json_encode()
  • Any custom one implementing the SerializerInterface
'Queue' => [
    ...
    'serializerClass' => \Queue\Utility\JsonSerializer::class,
    'serializerConfig' => [...],
],

Added new MailerTask specifically for sending reusable emails using Mailer objects, but without passing through actual objects.
Instead, the class string (FQCN) is passed only together with config.
This allows it to work with JSON strategy and even in between updates of the server (as passed objects could fail to be "unserialized").

$data = [
    'class' => TestMailer::class,
    'action' => 'testAction',
    'vars' => [...],
];
$queuedJobsTable->createJob('Queue.Mailer', $data);

Added same JSON safe strategy for EmailTask and deprecated the object ways here only to be used with legacy ObjectSerializer.

$data = [
    'class' => Message::class,
    'settings' => $settings,
];
$queuedJobsTable->createJob('Queue.Email', $data);

The benefit of JSON serializing is:

  • Less payload (data vs full object).
  • More resilient after updates for non finished tasks: object can fail to unserialize if different, data can be handled with migration if needed.
  • Easier to debug and modify (e.g. for local dev/testing).