| @@ 78-100 (lines=23) @@ | ||
| 75 | } |
|
| 76 | } |
|
| 77 | ||
| 78 | foreach ($this->container->getConsumers() as $consumerAliasName => $entity) { |
|
| 79 | try { |
|
| 80 | /** @var QueueEntity $entity */ |
|
| 81 | $entity->delete(); |
|
| 82 | $this->output->writeln( |
|
| 83 | sprintf( |
|
| 84 | "Deleted entity <info>%s</info> for consumer [<fg=yellow>%s</>]", |
|
| 85 | (string)$entity->getAliasName(), |
|
| 86 | (string)$consumerAliasName |
|
| 87 | ) |
|
| 88 | ); |
|
| 89 | } catch (\Exception $e) { |
|
| 90 | $hasErrors = true; |
|
| 91 | $this->output->error( |
|
| 92 | sprintf( |
|
| 93 | "Could not delete entity %s for consumer [%s], got:\n%s", |
|
| 94 | (string)$entity->getAliasName(), |
|
| 95 | (string)$consumerAliasName, |
|
| 96 | (string)$e->getMessage() |
|
| 97 | ) |
|
| 98 | ); |
|
| 99 | } |
|
| 100 | } |
|
| 101 | return (int)$hasErrors; |
|
| 102 | } |
|
| 103 | } |
|
| @@ 95-111 (lines=17) @@ | ||
| 92 | ||
| 93 | $hasErrors = false; |
|
| 94 | /** @var QueueEntity|ExchangeEntity $entity */ |
|
| 95 | foreach ($this->container->getPublishers() as $publisherName => $entity) { |
|
| 96 | try { |
|
| 97 | $this->createEntity($entity, 'publisher', $publisherName, $forceRecreate); |
|
| 98 | } catch (AMQPProtocolChannelException $e) { |
|
| 99 | $hasErrors = true; |
|
| 100 | $this->output->error( |
|
| 101 | sprintf( |
|
| 102 | "Could not create entity %s for publisher [%s], got:\n%s", |
|
| 103 | (string)$entity->getAliasName(), |
|
| 104 | (string)$publisherName, |
|
| 105 | (string)$e->getMessage() |
|
| 106 | ) |
|
| 107 | ); |
|
| 108 | // @todo Fix type mismatch |
|
| 109 | $entity->getConnection()->reconnect(); |
|
| 110 | } |
|
| 111 | } |
|
| 112 | ||
| 113 | /** @var QueueEntity|ExchangeEntity $entity */ |
|
| 114 | foreach ($this->container->getConsumers() as $publisherName => $entity) { |
|
| @@ 114-130 (lines=17) @@ | ||
| 111 | } |
|
| 112 | ||
| 113 | /** @var QueueEntity|ExchangeEntity $entity */ |
|
| 114 | foreach ($this->container->getConsumers() as $publisherName => $entity) { |
|
| 115 | try { |
|
| 116 | $this->createEntity($entity, 'consumer', $publisherName, $forceRecreate); |
|
| 117 | } catch (AMQPProtocolChannelException $e) { |
|
| 118 | $hasErrors = true; |
|
| 119 | $this->output->error( |
|
| 120 | sprintf( |
|
| 121 | "Could not create entity %s for consumer [%s], got:\n%s", |
|
| 122 | (string)$entity->getAliasName(), |
|
| 123 | (string)$publisherName, |
|
| 124 | (string)$e->getMessage() |
|
| 125 | ) |
|
| 126 | ); |
|
| 127 | // @todo Fix type mismatch |
|
| 128 | $entity->getConnection()->reconnect(); |
|
| 129 | } |
|
| 130 | } |
|
| 131 | ||
| 132 | $this->output->block("Create binds"); |
|
| 133 | /** @var PublisherInterface $entity */ |
|
| @@ 158-179 (lines=22) @@ | ||
| 155 | } |
|
| 156 | ||
| 157 | /** @var ConsumerInterface $entity */ |
|
| 158 | foreach ($this->container->getConsumers() as $consumerAliasName => $entity) { |
|
| 159 | try { |
|
| 160 | $entity->bind(); |
|
| 161 | $this->output->writeln( |
|
| 162 | sprintf( |
|
| 163 | "Bind entity <info>%s</info> for consumer [<fg=yellow>%s</>]", |
|
| 164 | (string)$entity->getAliasName(), |
|
| 165 | (string)$consumerAliasName |
|
| 166 | ) |
|
| 167 | ); |
|
| 168 | } catch (\Exception $e) { |
|
| 169 | $hasErrors = true; |
|
| 170 | $this->output->error( |
|
| 171 | sprintf( |
|
| 172 | "Could not create bind %s for consumer [%s], got:\n%s", |
|
| 173 | (string)$entity->getAliasName(), |
|
| 174 | (string)$consumerAliasName, |
|
| 175 | (string)$e->getMessage() |
|
| 176 | ) |
|
| 177 | ); |
|
| 178 | } |
|
| 179 | } |
|
| 180 | return (int)$hasErrors; |
|
| 181 | } |
|
| 182 | } |
|