This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree 2 files changed +41
-0
lines changed
app/code/Magento/WebapiAsync
Plugin/Communication/Config
2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magento \WebapiAsync \Plugin \Communication \Config ;
10
+
11
+ use Magento \AsynchronousOperations \Model \ConfigInterface ;
12
+ use Magento \Framework \Communication \ConfigInterface as CommunicationConfig ;
13
+
14
+ class CompositeReader
15
+ {
16
+ /**
17
+ * Topics with type schema is always are sync
18
+ * @see \Magento\Framework\Communication\Config\ReflectionGenerator::generateTopicConfigForServiceMethod().
19
+ * This plugin add support for topic type schema defined as ServiceName:methodName
20
+ * by force changing sync type to async
21
+ * but only if topic name starts with ConfigInterface::TOPIC_PREFIX, e.g. async.*
22
+ *
23
+ * @param \Magento\Framework\Communication\Config\CompositeReader $subject
24
+ * @param array $result
25
+ *
26
+ * @return array
27
+ * @SuppressWarnings(PHPMD.UnusedLocalVariable)
28
+ */
29
+ public function afterRead (\Magento \Framework \Communication \Config \CompositeReader $ subject , array $ result ) {
30
+ foreach ($ result [CommunicationConfig::TOPICS ] as $ topicName => $ topicConfig ) {
31
+ if (strpos ($ topicName , ConfigInterface::DEFAULT_HANDLER_NAME ) === 0 ) {
32
+ $ topicConfig [CommunicationConfig::TOPIC_IS_SYNCHRONOUS ] = false ;
33
+ $ result [CommunicationConfig::TOPICS ][$ topicName ] = $ topicConfig ;
34
+ }
35
+ }
36
+ return $ result ;
37
+ }
38
+ }
Original file line number Diff line number Diff line change 42
42
<argument name =" processorPath" xsi : type =" const" >Magento\WebapiAsync\Controller\Rest\AsynchronousSchemaRequestProcessor::BULK_PROCESSOR_PATH</argument >
43
43
</arguments >
44
44
</virtualType >
45
+ <type name =" Magento\Framework\Communication\Config\CompositeReader" >
46
+ <plugin name =" forceTopicsTypeToAsync" type =" Magento\WebapiAsync\Plugin\Communication\Config\CompositeReader" />
47
+ </type >
45
48
</config >
You can’t perform that action at this time.
0 commit comments