-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
468d15c
commit 4a86613
Showing
11 changed files
with
115 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Enum\Messenger; | ||
|
||
enum TransportName: string | ||
{ | ||
case INDEX_QUEUE = 'pimcore_generic_data_index_queue'; | ||
case SYNC = 'pimcore_generic_data_index_sync'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Enum\SearchIndex; | ||
|
||
enum IndexName: string | ||
{ | ||
case ASSET = 'asset'; | ||
case DATA_OBJECT = 'data-object'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\Message; | ||
|
||
class DispatchQueueMessagesMessage | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under following license: | ||
* - Pimcore Commercial License (PCL) | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\GenericDataIndexBundle\MessageHandler; | ||
|
||
use Pimcore\Bundle\GenericDataIndexBundle\Message\DispatchQueueMessagesMessage; | ||
use Pimcore\Bundle\GenericDataIndexBundle\Message\IndexUpdateQueueMessage; | ||
use Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexQueueService; | ||
use Symfony\Component\Messenger\Attribute\AsMessageHandler; | ||
use Symfony\Component\Messenger\MessageBusInterface; | ||
|
||
#[AsMessageHandler] | ||
class DispatchQueueMessagesHandler | ||
{ | ||
public function __construct( | ||
protected readonly IndexQueueService $indexQueueService, | ||
protected readonly MessageBusInterface $messageBus | ||
) { | ||
} | ||
|
||
public function __invoke(DispatchQueueMessagesMessage $message): void | ||
{ | ||
$batchSize = 20; | ||
while (true) { | ||
$entries = $this->indexQueueService->getUnhandledIndexQueueEntries(true, $batchSize); | ||
$amountOfEntries = count($entries); | ||
|
||
if ($amountOfEntries > 0) { | ||
$this->messageBus->dispatch(new IndexUpdateQueueMessage($entries)); | ||
} | ||
|
||
if ($amountOfEntries < $batchSize) { | ||
break; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters