Skip to content

Commit 68634d2

Browse files
committed
BUGFIX: FakeQueue should also use the cached message passing
1 parent fd9ec29 commit 68634d2

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

Classes/Queue/FakeQueue.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313

1414
use Neos\Flow\Annotations as Flow;
15+
use Neos\Cache\Frontend\VariableFrontend;
1516
use Neos\Flow\Core\Booting\Scripts;
1617
use Neos\Flow\Utility\Algorithms;
1718

@@ -38,6 +39,12 @@ class FakeQueue implements QueueInterface
3839
*/
3940
protected $async = false;
4041

42+
/**
43+
* @Flow\Inject
44+
* @var VariableFrontend
45+
*/
46+
protected $messageCache;
47+
4148
/**
4249
* @param string $name
4350
* @param array $options
@@ -76,14 +83,17 @@ public function submit($payload, array $options = [])
7683
{
7784
$messageId = Algorithms::generateUUID();
7885
$message = new Message($messageId, $payload);
79-
$commandArguments = [$this->name, base64_encode(serialize($message))];
86+
87+
$messageCacheIdentifier = sha1(serialize($message));
88+
$this->messageCache->set($messageCacheIdentifier, serialize($message));
89+
8090
if ($this->async) {
8191
if (!method_exists(Scripts::class, 'executeCommandAsync')) {
8292
throw new \RuntimeException('The "async" flag is set, but the currently used Flow version doesn\'t support this (Flow 3.3+ is required)', 1469116604);
8393
}
84-
Scripts::executeCommandAsync('flowpack.jobqueue.common:job:execute', $this->flowSettings, $commandArguments);
94+
Scripts::executeCommandAsync('flowpack.jobqueue.common:job:execute', $this->flowSettings, [$this->name, $messageCacheIdentifier]);
8595
} else {
86-
Scripts::executeCommand('flowpack.jobqueue.common:job:execute', $this->flowSettings, true, $commandArguments);
96+
Scripts::executeCommand('flowpack.jobqueue.common:job:execute', $this->flowSettings, true, [$this->name, $messageCacheIdentifier]);
8797
}
8898
return $messageId;
8999
}
@@ -149,7 +159,7 @@ public function count()
149159
*/
150160
public function flush()
151161
{
152-
//
162+
// The FakeQueue does not support message flushing
153163
}
154164

155165
}

0 commit comments

Comments
 (0)