Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Added new Exchange type
Browse files Browse the repository at this point in the history
  • Loading branch information
Radovan Kepák committed Mar 29, 2022
1 parent cb483b3 commit b025a3a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/DI/Helpers/ExchangesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
final class ExchangesHelper extends AbstractHelper
{

public const EXCHANGE_TYPES = ['direct', 'topic', 'headers', 'fanout'];
//public const CREATE_TYPES = [0 => false, 1 => true, 2 => 'lazy'];
public const EXCHANGE_TYPES = ['direct', 'topic', 'headers', 'fanout', 'x-delayed-message'];

public function getConfigSchema(): Schema
{
Expand Down
9 changes: 7 additions & 2 deletions src/DI/RabbitMQExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use Nette\DI\CompilerExtension;
use Nette\DI\Definitions\Statement;
use Nette\DI\PhpGenerator;
use Nette\PhpGenerator\Literal;
use Nette\PhpGenerator\PhpLiteral;
use Nette\PhpGenerator\Closure;
use Nette\Schema\Expect;
use Nette\Schema\Schema;

Expand Down Expand Up @@ -108,7 +108,12 @@ protected function processConfig(PhpGenerator $generator, mixed &$item): void
$this->processConfig($generator, $value);
}
} elseif ($item instanceof Statement) {
$item = new PhpLiteral($generator->formatStatement($item));
if (class_exists(Literal::class)) {
$item = new Literal($generator->formatStatement($item));
} else {
/** @psalm-suppress DeprecatedClass */
$item = new PhpLiteral($generator->formatStatement($item));
}
}
}
}
2 changes: 1 addition & 1 deletion src/Exchange/ExchangeDeclarator.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function declareExchange(string $name): void
$federation['policy']
);
} catch (\RuntimeException $e) {
throw new ExchangeFactoryException("Failed to create federated exchange [$name]", $e->getCode(), $e);
throw new ExchangeFactoryException("Failed to create federated exchange [$name]", (int) $e->getCode(), $e);
}
}
}
Expand Down

0 comments on commit b025a3a

Please sign in to comment.