Skip to content

Commit

Permalink
respect cache configuration in SymfonyBundle's MessagingSystemFactory (
Browse files Browse the repository at this point in the history
  • Loading branch information
someniatko authored Oct 13, 2023
1 parent bd545a1 commit 5aa06af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public function process(ContainerBuilder $container): void
$definition = new Definition();
$definition->setClass(MessagingSystemFactory::class);
$definition->addArgument(new Reference('service_container'));
$definition->addArgument(new Reference(ServiceCacheConfiguration::REFERENCE_NAME));
$definition->addArgument(new Reference(ReferenceSearchService::class));
$container->setDefinition(MessagingSystemFactory::class, $definition);

Expand Down
11 changes: 8 additions & 3 deletions packages/Symfony/SymfonyBundle/MessagingSystemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
namespace Ecotone\SymfonyBundle;

use Ecotone\Messaging\Config\ConfiguredMessagingSystem;
use Ecotone\Messaging\Config\ServiceCacheConfiguration;
use Ecotone\Messaging\Handler\ReferenceSearchService;
use Ecotone\SymfonyBundle\DepedencyInjection\Compiler\EcotoneCompilerPass;
use Symfony\Component\DependencyInjection\ContainerInterface;

class MessagingSystemFactory
{
public function __construct(private ContainerInterface $container, private ReferenceSearchService $referenceSearchService)
{
public function __construct(
private ContainerInterface $container,
private ServiceCacheConfiguration $cacheConfiguration,
private ReferenceSearchService $referenceSearchService,
) {
}

public function __invoke(): ConfiguredMessagingSystem
{
$configuration = EcotoneCompilerPass::getMessagingConfiguration($this->container, true);
$useCache = $this->cacheConfiguration->shouldUseCache();
$configuration = EcotoneCompilerPass::getMessagingConfiguration($this->container, $useCache);

$messagingSystem = $configuration->buildMessagingSystemFromConfiguration($this->referenceSearchService);
$this->referenceSearchService->setConfiguredMessagingSystem($messagingSystem);
Expand Down

0 comments on commit 5aa06af

Please sign in to comment.