Skip to content

Commit

Permalink
Update courier/courier
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioheleno committed Apr 3, 2022
1 parent d5c3a94 commit ac95eff
Show file tree
Hide file tree
Showing 29 changed files with 403 additions and 256 deletions.
36 changes: 26 additions & 10 deletions app/dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
use Composer\Semver\VersionParser;
use Courier\Bus;
use Courier\Client\Consumer;
use Courier\Client\Producer;
use Courier\Client\Producer\BufferedProducer;
use Courier\Client\Producer\Producer;
use Courier\Client\Producer\ProducerInterface;
use Courier\Inflector\InterfaceInflector;
use Courier\Locator\ContainerLocator;
use Courier\Middleware\EnvelopeCompressionMiddleware;
use Courier\Router\SimpleRouter;
use Courier\Serializer\IgBinarySerializer;
use Courier\Transport\AmqpTransport;
use DI\ContainerBuilder;
use Monolog\Handler\StreamHandler;
Expand Down Expand Up @@ -49,7 +53,7 @@

return new Bus(
new SimpleRouter(),
new AmqpTransport($settings->getString('queue.dsn'))
AmqpTransport::fromDsn($settings->getString('queue.dsn'))
);
},
CacheItemPoolInterface::class => function (ContainerInterface $container): Pool {
Expand Down Expand Up @@ -95,19 +99,19 @@
)
);
},
CacheProvider::class => autowire(CacheProvider::class),
Consumer::class => function (ContainerInterface $container): Consumer {
return new Consumer(
$consumer = new Consumer(
$container->get(Bus::class),
new InterfaceInflector(),
new ContainerLocator($container),
new InterfaceInflector()
);
},
Producer::class => function (ContainerInterface $container): Producer {
return new Producer(
$container->get(Bus::class)
new IgBinarySerializer()
);

$consumer->addMiddleware(new EnvelopeCompressionMiddleware());

return $consumer;
},
CacheProvider::class => autowire(CacheProvider::class),
LoggerInterface::class => function (ContainerInterface $container): LoggerInterface {
$settings = $container->get(SettingsInterface::class);

Expand Down Expand Up @@ -153,6 +157,18 @@
]
);
},
ProducerInterface::class => function (ContainerInterface $container): ProducerInterface {
$producer = new BufferedProducer(
new Producer(
$container->get(Bus::class),
new IgBinarySerializer()
)
);

$producer->addMiddleware(new EnvelopeCompressionMiddleware());

return $producer;
},
SvgFlatRender::class => autowire(SvgFlatRender::class),
SvgFlatSquareRender::class => autowire(SvgFlatSquareRender::class),
SvgPlasticRender::class => autowire(SvgPlasticRender::class),
Expand Down
21 changes: 14 additions & 7 deletions app/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,50 @@
$router
->addRoute(
DependencyUpdatedEvent::class,
DependencyUpdatedListener::class
DependencyUpdatedListener::class,
'DependencyUpdated'
);

/* PACKAGE EVENTS */
$router
->addRoute(
PackageCreatedEvent::class,
PackageCreatedListener::class
PackageCreatedListener::class,
'PackageCreated'
)
->addRoute(
PackageUpdatedEvent::class,
PackageUpdatedListener::class
PackageUpdatedListener::class,
'PackageUpdated'
);

/* VERSION EVENTS */
$router
->addRoute(
VersionCreatedEvent::class,
VersionCreatedListener::class
VersionCreatedListener::class,
'VersionCreated'
);

/* PACKAGE COMMANDS */
$router->addRoute(
PackageDiscoveryCommand::class,
PackageDiscoveryHandler::class
PackageDiscoveryHandler::class,
'PackageDiscovery'
);

/* DEPENDENCY COMMANDS */
$router->addRoute(
UpdateDependencyStatusCommand::class,
UpdateDependencyStatusHandler::class
UpdateDependencyStatusHandler::class,
'UpdateDependencyStatus'
);

/* VERSION COMMANDS */
$router->addRoute(
UpdateVersionStatusCommand::class,
UpdateVersionStatusHandler::class
UpdateVersionStatusHandler::class,
'UpdateVersionStatus'
);

$bus->bindRoutes();
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@
"composer/semver": "^3.2",
"courier/courier": "dev-main",
"courier/locator-container": "dev-main",
"courier/middleware-envelope-compression": "dev-main",
"courier/serializer-igbinary": "dev-main",
"courier/transport-amqp": "dev-main",
"kriswallsmith/buzz": "^1.2",
"monolog/monolog": "^2.3",
"nyholm/dsn": "^2.0",
"nyholm/psr7": "^1.5",
"nyholm/psr7-server": "^1.0",
"php-di/php-di": "^6.3",
"phpunit/php-timer": "^5.0",
"psr/cache": "^1.0",
"psr/container": "^1.0",
"psr/log": "^2.0",
Expand Down
Loading

0 comments on commit ac95eff

Please sign in to comment.