Hi all, I have a question regarding Glue (Storefr...
# help
m
Hi all, I have a question regarding Glue (Storefront and Backend). We have been using the new architecture of api separation between Storefront and Backend for quite a while already. Today I noticed that in the release https://api.release.spryker.com/release-group/4792 (already integrated in my project) the
EventBehaviorEventDispatcherPlugin
was added in the dispatcher list. So far so good..let`s say. But the problem arose the moment we noticed that in the GlueStorefrontApplication the
EventDispatcherApplicationPlugin
plugin was missing in the list of Application Plugins (
\Pyz\GlueStorefrontApiApplication\GlueStorefrontApiApplicationDependencyProvider::getApplicationPlugins
). Once you add this (of course the Glue one) you trigger a lot of problems since the plugin event dispatchers are in common and the Storefront cannot run the
EventBehaviorEventDispatcherPlugin
since it has no dependency with propel etc.. that the plugin needs. Now two things are: should be separated the event dispatcher plugins based on the application, as done between zed and yves, or the plugins should be inserted based on the current application. Does anyone have the same problem encountered? @green-ocean-22823 U are the person that released it under ticket CC-27948. Do u have an idea why the
EventDispatcherApplicationPlugin
is missing for Storefront and why the
EventBehaviorEventDispatcherPlugin
was added even if it cannot run for Storefront? Thank u in advance and BR Gio p.s.: if the
EventDispatcherApplicationPlugin
is missing in Storefront then for every call u have the error as follow:
Copy code
Spryker.CRITICAL: Spryker\Service\Container\Exception\NotFoundException - The requested service "dispatcher" was not found in the container! in "/current/vendor/spryker/container/src/Spryker/Service/Container/Container.php::262" {"exception":"[object] (Spryker\\Service\\Container\\Exception\\NotFoundException(code: 0): The requested service \"dispatcher\" was not found in the container! at /current/vendor/spryker/container/src/Spryker/Service/Container/Container.php:262)

[stacktrace]

#0 /current/vendor/spryker/container/src/Spryker/Service/Container/Container.php(216): Spryker\\Service\\Container\\Container->getService('dispatcher')

#1 /current/vendor/spryker/http/src/Spryker/Glue/Http/Plugin/Application/HttpApplicationPlugin.php(159): Spryker\\Service\\Container\\Container->get('dispatcher')

#2 /current/vendor/spryker/http/src/Spryker/Glue/Http/Plugin/Application/HttpApplicationPlugin.php(94): Spryker\\Glue\\Http\\Plugin\\Application\\HttpApplicationPlugin->getEventDispatcher(Object(Spryker\\Shared\\Kernel\\Container\\ContainerProxy))

#3 /current/vendor/spryker/container/src/Spryker/Service/Container/Container.php(279): Spryker\\Glue\\Http\\Plugin\\Application\\HttpApplicationPlugin->Spryker\\Glue\\Http\\Plugin\\Application\\{closure}(Object(Spryker\\Shared\\Kernel\\Container\\ContainerProxy))

#4 /current/vendor/spryker/container/src/Spryker/Service/Container/Container.php(216): Spryker\\Service\\Container\\Container->getService('kernel')

#5 /current/vendor/spryker/application/src/Spryker/Shared/Application/Application.php(196): Spryker\\Service\\Container\\Container->get('kernel')

#6 /current/vendor/spryker/application/src/Spryker/Shared/Application/Application.php(178): Spryker\\Shared\\Application\\Application->getKernel()

#7 /current/vendor/spryker/glue-application/src/Spryker/Glue/GlueApplication/ApiApplication/ApiApplicationProxy.php(190): Spryker\\Shared\\Application\\Application->terminate(Object(Symfony\\Component\\HttpFoundation\\Request), Object(Symfony\\Component\\HttpFoundation\\Response))

#8 /current/vendor/spryker/glue-application/src/Spryker/Glue/GlueApplication/ApiApplication/ApiApplicationProxy.php(159): Spryker\\Glue\\GlueApplication\\ApiApplication\\ApiApplicationProxy->terminateApplication(Object(Spryker\\Glue\\GlueStorefrontApiApplication\\Application\\GlueStorefrontApiApplication), Object(Symfony\\Component\\HttpFoundation\\Response))

#9 /current/public/GlueStorefront/index.php(20): Spryker\\Glue\\GlueApplication\\ApiApplication\\ApiApplicationProxy->run()

#10 {main}

"} {"environment":{"application":"GLUE_STOREFRONT","environment":"production","codeBucket":"DE","store":"DE","locale":"de_DE"},"server": ....
👀 1
p
Were you able to reproduce the same behavior in https://github.com/spryker-shop/suite ?
g
Hey @mammoth-autumn-37948 Let’s try to describe original issue that we released/fixed recently (https://github.com/spryker-shop/suite/pull/1268/files) Prerequisite: We have different applications: • Glue (deprecated) • Storefront API (SAPI) • Backend API (BAPI) • Zed • Yves • etc. Original bug: When an entity is created / updated / deleted via Storefront / Backoffice, the
EventBehaviorEventDispatcherPlugin
is executed, so the entities in
spy_event_behavior_entity_change
are processed without delay. However, when an entity is created / updated / deleted via Backend API, the
EventBehaviorEventDispatcherPlugin
is not executed, so events are being processed only by
event:trigger:timeout
console command that is executed every 5 minutes. So, we possibly need to enable
EventBehaviorEventDispatcherPlugin
(or provide a similar plugin) for Backend API. The same issue is possibly actual for Storefront API as well. The last sentence is wrong because Storefront API has the same approach that we have in deprecated GLUE. Requests from SAPI/GLUE applications will go to ZED application throw zed-call (if you want persist something in DB). In Zed application we handle it by default. So regarding issue, BAPI didn’t make real zed-call and it means that in BAPI we do direct call to Facade. During persistent calls (using BAPI) we lost the handler of such create/update/delete events.
BAPI -> Facade -> DB SAPI -> Client -> zed call -> Facade -> DB
m
Thank you for the comprehensive answer... Everything was clear to me of why and how the whole thing works...the problem though seems to be that in SAPI the EntityEventDispatcher plugin generates error... Are you aware of this? SAPI does not need the plugin, because in case of zed call then the BackendGateway is responsable for it..
BGateway has already this plugin in own dispatcher plugins registered.. but SAPI, like Yves, should be decoupled from it...
👍 1
g
the problem though seems to be that in SAPI the EntityEventDispatcher plugin generates error... Are you aware of this?
I couldn’t find it in https://github.com/spryker-shop/suite/blob/master/src/Pyz/Glue/GlueStorefrontApiApplication/GlueStorefrontApiApplicationDependencyProvider.php
m
yes right, because, about me, StorefrontApplication DP is mssing the EventDispatcherPlugin in ApplicationPlugins... Error!! It needs it! But in the moment u register it in application plugins then the EventBehaviorEventDispatcherPlugin in common (BAPI e SAPI) cannot be run in SAPI Application
g
oh, I got it, we will create a blocker ticket for that Thanks
m
Thank u! 👍
🤝 1