25 private $communicationReader;
35 $this->communicationReader = $communicationReader;
44 public function read($scope =
null)
46 $remoteServiceTopics = $this->communicationReader->read($scope);
49 $queueExchangeTopicToQueueMap = [];
50 foreach ($remoteServiceTopics[CommunicationConfig::TOPICS] as $topicName => $communicationConfig) {
51 $queueTopics[$topicName] = [
52 QueueConfig::TOPIC_NAME => $topicName,
53 QueueConfig::TOPIC_SCHEMA => [
54 QueueConfig::TOPIC_SCHEMA_TYPE => QueueConfig::TOPIC_SCHEMA_TYPE_METHOD,
55 QueueConfig::TOPIC_SCHEMA_VALUE => $communicationConfig[CommunicationConfig::TOPIC_REQUEST]
57 QueueConfig::TOPIC_RESPONSE_SCHEMA => [
58 QueueConfig::TOPIC_SCHEMA_TYPE => isset($communicationConfig[CommunicationConfig::TOPIC_RESPONSE])
59 ? QueueConfig::TOPIC_SCHEMA_TYPE_OBJECT
61 QueueConfig::TOPIC_SCHEMA_VALUE => $communicationConfig[CommunicationConfig::TOPIC_RESPONSE]
66 $queueName =
'queue.' . $topicName;
67 $queueBinds[$topicName .
'--' . self::DEFAULT_EXCHANGE .
'--' . $queueName] = [
68 QueueConfig::BIND_TOPIC => $topicName,
70 QueueConfig::BIND_QUEUE => $queueName,
73 $queueExchangeTopicToQueueMap[self::DEFAULT_EXCHANGE .
'--' . $topicName] = [$queueName];
76 self::DEFAULT_PUBLISHER => [
83 QueueConfig::PUBLISHERS => $queuePublishers,
84 QueueConfig::TOPICS => $queueTopics,
85 QueueConfig::CONSUMERS => [],
86 QueueConfig::BINDS => $queueBinds,
87 QueueConfig::EXCHANGE_TOPIC_TO_QUEUES_MAP => $queueExchangeTopicToQueueMap,
__construct(Communication $communicationReader)