webapiAsyncConfig = $webapiAsyncConfig; $this->reflectionGenerator = $reflectionGenerator; } /** * Generate communication configuration based on remote services declarations * * @param string|null $scope * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function read($scope = null) { $asyncServicesData = $this->webapiAsyncConfig->getServices(); $result = []; foreach ($asyncServicesData as $serviceData) { $topicName = $serviceData[WebApiAsyncConfig::SERVICE_PARAM_KEY_TOPIC]; $serviceClass = $serviceData[WebApiAsyncConfig::SERVICE_PARAM_KEY_INTERFACE]; $serviceMethod = $serviceData[WebApiAsyncConfig::SERVICE_PARAM_KEY_METHOD]; $topicConfig = $this->reflectionGenerator->generateTopicConfigForServiceMethod( $topicName, $serviceClass, $serviceMethod, [ WebApiAsyncConfig::DEFAULT_HANDLER_NAME => [ CommunicationConfig::HANDLER_TYPE => $serviceClass, CommunicationConfig::HANDLER_METHOD => $serviceMethod, ], ], false ); $rewriteTopicParams = [ CommunicationConfig::TOPIC_IS_SYNCHRONOUS => false, CommunicationConfig::TOPIC_RESPONSE => null, ]; $result[$topicName] = array_merge($topicConfig, $rewriteTopicParams); } $result[WebApiAsyncConfig::SYSTEM_TOPIC_NAME] = WebApiAsyncConfig::SYSTEM_TOPIC_CONFIGURATION; return [CommunicationConfig::TOPICS => $result]; } }