diff --git a/src/Prooph/ServiceBus/Command/CommandReceiver.php b/src/Prooph/ServiceBus/Command/CommandReceiver.php index cebb365..9de4637 100644 --- a/src/Prooph/ServiceBus/Command/CommandReceiver.php +++ b/src/Prooph/ServiceBus/Command/CommandReceiver.php @@ -14,7 +14,7 @@ use Prooph\ServiceBus\Exception\RuntimeException; use Prooph\ServiceBus\Message\MessageInterface; use Prooph\ServiceBus\Service\Definition; -use Prooph\ServiceBus\Service\InvokeStrategyManager; +use Prooph\ServiceBus\Service\InvokeStrategyLoader; use Zend\EventManager\EventManager; use Zend\EventManager\EventManagerInterface; use Zend\ServiceManager\ServiceLocatorInterface; @@ -50,7 +50,7 @@ class CommandReceiver implements CommandReceiverInterface /** * @var ServiceLocatorInterface */ - protected $invokeStrategyManager; + protected $invokeStrategyLoader; /** * @var EventManagerInterface @@ -101,7 +101,7 @@ public function handle(MessageInterface $aMessage) $invokeStrategy = null; foreach ($this->getInvokeStrategies() as $invokeStrategyName) { - $invokeStrategy = $this->getInvokeStrategyManager()->get($invokeStrategyName); + $invokeStrategy = $this->getInvokeStrategyLoader()->get($invokeStrategyName); if ($invokeStrategy->canInvoke($handler, $command)) { break; @@ -164,23 +164,23 @@ public function getInvokeStrategies() } /** - * @param ServiceLocatorInterface $anInvokeStrategyManager + * @param ServiceLocatorInterface $anInvokeStrategyLoader */ - public function setInvokeStrategyManager(ServiceLocatorInterface $anInvokeStrategyManager) + public function setInvokeStrategyLoader(ServiceLocatorInterface $anInvokeStrategyLoader) { - $this->invokeStrategyManager = $anInvokeStrategyManager; + $this->invokeStrategyLoader = $anInvokeStrategyLoader; } /** * @return ServiceLocatorInterface */ - public function getInvokeStrategyManager() + public function getInvokeStrategyLoader() { - if (is_null($this->invokeStrategyManager)) { - $this->invokeStrategyManager = new InvokeStrategyManager(); + if (is_null($this->invokeStrategyLoader)) { + $this->invokeStrategyLoader = new InvokeStrategyLoader(); } - return $this->invokeStrategyManager; + return $this->invokeStrategyLoader; } public function events() diff --git a/src/Prooph/ServiceBus/Command/DefaultCommandBusFactory.php b/src/Prooph/ServiceBus/Command/DefaultCommandBusFactory.php index 60c52ce..17a26c8 100644 --- a/src/Prooph/ServiceBus/Command/DefaultCommandBusFactory.php +++ b/src/Prooph/ServiceBus/Command/DefaultCommandBusFactory.php @@ -12,7 +12,7 @@ namespace Prooph\ServiceBus\Command; use Prooph\ServiceBus\Exception\RuntimeException; -use Prooph\ServiceBus\Service\CommandBusManager; +use Prooph\ServiceBus\Service\CommandBusLoader; use Prooph\ServiceBus\Service\Definition; use Zend\ServiceManager\AbstractFactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; @@ -36,7 +36,7 @@ class DefaultCommandBusFactory implements AbstractFactoryInterface */ public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { - return $serviceLocator instanceof CommandBusManager; + return $serviceLocator instanceof CommandBusLoader; } /** @@ -50,11 +50,11 @@ public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator */ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { - if (!$serviceLocator instanceof CommandBusManager) { + if (!$serviceLocator instanceof CommandBusLoader) { throw new RuntimeException( sprintf( "%s is used in the wrong context. It can only be used within a' - . ' Prooph\ServiceBus\Service\CommandBusManager", + . ' Prooph\ServiceBus\Service\CommandBusLoader", get_class($this) ) ); @@ -122,9 +122,9 @@ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $ ); } - $queue = $mainServiceLocator->get(Definition::QUEUE_MANAGER)->get($configuration[Definition::QUEUE]); + $queue = $mainServiceLocator->get(Definition::QUEUE_LOADER)->get($configuration[Definition::QUEUE]); - $messageDispatcher = $mainServiceLocator->get(Definition::MESSAGE_DISPATCHER_MANAGER) + $messageDispatcher = $mainServiceLocator->get(Definition::MESSAGE_DISPATCHER_LOADER) ->get($configuration[Definition::MESSAGE_DISPATCHER]); $commandBus = new CommandBus($requestedName, $messageDispatcher, $queue); diff --git a/src/Prooph/ServiceBus/Command/DefaultCommandReceiverFactory.php b/src/Prooph/ServiceBus/Command/DefaultCommandReceiverFactory.php index fca6889..3805857 100644 --- a/src/Prooph/ServiceBus/Command/DefaultCommandReceiverFactory.php +++ b/src/Prooph/ServiceBus/Command/DefaultCommandReceiverFactory.php @@ -12,7 +12,7 @@ namespace Prooph\ServiceBus\Command; use Prooph\ServiceBus\Exception\RuntimeException; -use Prooph\ServiceBus\Service\CommandReceiverManager; +use Prooph\ServiceBus\Service\CommandReceiverLoader; use Prooph\ServiceBus\Service\Definition; use Zend\ServiceManager\AbstractFactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; @@ -35,7 +35,7 @@ class DefaultCommandReceiverFactory implements AbstractFactoryInterface */ public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { - return $serviceLocator instanceof CommandReceiverManager; + return $serviceLocator instanceof CommandReceiverLoader; } /** @@ -49,11 +49,11 @@ public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator */ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { - if (!$serviceLocator instanceof CommandReceiverManager) { + if (!$serviceLocator instanceof CommandReceiverLoader) { throw new RuntimeException( sprintf( "%s is used in the wrong context. It can only be used within a' - . ' Prooph\ServiceBus\Service\CommandReceiverManager", + . ' Prooph\ServiceBus\Service\CommandReceiverLoader", get_class($this) ) ); @@ -120,9 +120,9 @@ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $ ); } - if ($mainServiceLocator->has(Definition::INVOKE_STRATEGY_MANAGER)) { - $commandReceiver->setInvokeStrategyManager( - $mainServiceLocator->get(Definition::INVOKE_STRATEGY_MANAGER) + if ($mainServiceLocator->has(Definition::INVOKE_STRATEGY_LOADER)) { + $commandReceiver->setInvokeStrategyLoader( + $mainServiceLocator->get(Definition::INVOKE_STRATEGY_LOADER) ); } diff --git a/src/Prooph/ServiceBus/Event/DefaultEventBusFactory.php b/src/Prooph/ServiceBus/Event/DefaultEventBusFactory.php index baa0cbb..662cd16 100644 --- a/src/Prooph/ServiceBus/Event/DefaultEventBusFactory.php +++ b/src/Prooph/ServiceBus/Event/DefaultEventBusFactory.php @@ -13,7 +13,7 @@ use Prooph\ServiceBus\Exception\RuntimeException; use Prooph\ServiceBus\Service\Definition; -use Prooph\ServiceBus\Service\EventBusManager; +use Prooph\ServiceBus\Service\EventBusLoader; use Zend\ServiceManager\AbstractFactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; @@ -35,7 +35,7 @@ class DefaultEventBusFactory implements AbstractFactoryInterface */ public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { - return $serviceLocator instanceof EventBusManager; + return $serviceLocator instanceof EventBusLoader; } /** @@ -49,11 +49,11 @@ public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator */ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { - if (!$serviceLocator instanceof EventBusManager) { + if (!$serviceLocator instanceof EventBusLoader) { throw new RuntimeException( sprintf( "%s is used in the wrong context. It can only be used within a' - . ' Prooph\ServiceBus\Service\EventBusManager", + . ' Prooph\ServiceBus\Service\EventBusLoader", get_class($this) ) ); @@ -123,17 +123,17 @@ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $ $queues = array(); - $queueManager = $mainServiceLocator->get(Definition::QUEUE_MANAGER); + $queueLoader = $mainServiceLocator->get(Definition::QUEUE_LOADER); if (is_string($configuration[Definition::QUEUE])) { - $queues[] = $queueManager->get($configuration[Definition::QUEUE]); + $queues[] = $queueLoader->get($configuration[Definition::QUEUE]); } else { foreach ($configuration[Definition::QUEUE] as $queueDefinition) { - $queues[] = $queueManager->get($queueDefinition); + $queues[] = $queueLoader->get($queueDefinition); } } - $messageDispatcher = $mainServiceLocator->get(Definition::MESSAGE_DISPATCHER_MANAGER) + $messageDispatcher = $mainServiceLocator->get(Definition::MESSAGE_DISPATCHER_LOADER) ->get($configuration[Definition::MESSAGE_DISPATCHER]); $eventBus = new EventBus($requestedName, $messageDispatcher, $queues); diff --git a/src/Prooph/ServiceBus/Event/DefaultEventReceiverFactory.php b/src/Prooph/ServiceBus/Event/DefaultEventReceiverFactory.php index 8de7cdb..8a717c5 100644 --- a/src/Prooph/ServiceBus/Event/DefaultEventReceiverFactory.php +++ b/src/Prooph/ServiceBus/Event/DefaultEventReceiverFactory.php @@ -13,7 +13,7 @@ use Prooph\ServiceBus\Exception\RuntimeException; use Prooph\ServiceBus\Service\Definition; -use Prooph\ServiceBus\Service\EventReceiverManager; +use Prooph\ServiceBus\Service\EventReceiverLoader; use Zend\ServiceManager\AbstractFactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; @@ -35,7 +35,7 @@ class DefaultEventReceiverFactory implements AbstractFactoryInterface */ public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { - return $serviceLocator instanceof EventReceiverManager; + return $serviceLocator instanceof EventReceiverLoader; } /** @@ -49,11 +49,11 @@ public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator */ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { - if (!$serviceLocator instanceof EventReceiverManager) { + if (!$serviceLocator instanceof EventReceiverLoader) { throw new RuntimeException( sprintf( "%s is used in the wrong context. It can only be used within a' - . ' Prooph\ServiceBus\Service\EventReceiverManager", + . ' Prooph\ServiceBus\Service\EventReceiverLoader", get_class($this) ) ); @@ -120,9 +120,9 @@ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $ ); } - if ($mainServiceLocator->has(Definition::INVOKE_STRATEGY_MANAGER)) { - $eventReceiver->setInvokeStrategyManager( - $mainServiceLocator->get(Definition::INVOKE_STRATEGY_MANAGER) + if ($mainServiceLocator->has(Definition::INVOKE_STRATEGY_LOADER)) { + $eventReceiver->setInvokeStrategyLoader( + $mainServiceLocator->get(Definition::INVOKE_STRATEGY_LOADER) ); } diff --git a/src/Prooph/ServiceBus/Event/EventReceiver.php b/src/Prooph/ServiceBus/Event/EventReceiver.php index 4d0149c..a6d4370 100644 --- a/src/Prooph/ServiceBus/Event/EventReceiver.php +++ b/src/Prooph/ServiceBus/Event/EventReceiver.php @@ -14,7 +14,7 @@ use Prooph\ServiceBus\Exception\RuntimeException; use Prooph\ServiceBus\Message\MessageInterface; use Prooph\ServiceBus\Service\Definition; -use Prooph\ServiceBus\Service\InvokeStrategyManager; +use Prooph\ServiceBus\Service\InvokeStrategyLoader; use Zend\EventManager\EventManager; use Zend\EventManager\EventManagerInterface; use Zend\ServiceManager\ServiceLocatorInterface; @@ -50,7 +50,7 @@ class EventReceiver implements EventReceiverInterface /** * @var ServiceLocatorInterface */ - protected $invokeStrategyManager; + protected $invokeStrategyLoader; /** * @var EventManagerInterface @@ -105,7 +105,7 @@ public function handle(MessageInterface $aMessage) $invokeStrategy = null; foreach ($this->getInvokeStrategies() as $invokeStrategyName) { - $invokeStrategy = $this->getInvokeStrategyManager()->get($invokeStrategyName); + $invokeStrategy = $this->getInvokeStrategyLoader()->get($invokeStrategyName); if ($invokeStrategy->canInvoke($handler, $event)) { break; @@ -167,23 +167,23 @@ public function getInvokeStrategies() } /** - * @param ServiceLocatorInterface $anInvokeStrategyManager + * @param ServiceLocatorInterface $anInvokeStrategyLoader */ - public function setInvokeStrategyManager(ServiceLocatorInterface $anInvokeStrategyManager) + public function setInvokeStrategyLoader(ServiceLocatorInterface $anInvokeStrategyLoader) { - $this->invokeStrategyManager = $anInvokeStrategyManager; + $this->invokeStrategyLoader = $anInvokeStrategyLoader; } /** * @return ServiceLocatorInterface */ - public function getInvokeStrategyManager() + public function getInvokeStrategyLoader() { - if (is_null($this->invokeStrategyManager)) { - $this->invokeStrategyManager = new InvokeStrategyManager(); + if (is_null($this->invokeStrategyLoader)) { + $this->invokeStrategyLoader = new InvokeStrategyLoader(); } - return $this->invokeStrategyManager; + return $this->invokeStrategyLoader; } /** diff --git a/src/Prooph/ServiceBus/Initializer/LocalSynchronousInitializer.php b/src/Prooph/ServiceBus/Initializer/LocalSynchronousInitializer.php index ce34cd3..b8fa844 100644 --- a/src/Prooph/ServiceBus/Initializer/LocalSynchronousInitializer.php +++ b/src/Prooph/ServiceBus/Initializer/LocalSynchronousInitializer.php @@ -183,16 +183,16 @@ public function initializeLocalServiceBus(InitializeEvent $e) $serviceBusManager->setService('configuration', $configuration); /* @var $messageDispatcher \Prooph\ServiceBus\Message\InMemoryMessageDispatcher */ - $messageDispatcher = $serviceBusManager->get('message_dispatcher_manager')->get('in_memory_message_dispatcher'); + $messageDispatcher = $serviceBusManager->get(Definition::MESSAGE_DISPATCHER_LOADER)->get('in_memory_message_dispatcher'); - $commandReceiverManager = $serviceBusManager->get('command_receiver_manager'); + $commandReceiverLoader = $serviceBusManager->get(Definition::COMMAND_RECEIVER_LOADER); - $eventReceiverManager = $serviceBusManager->get('event_receiver_manager'); + $eventReceiverLoader = $serviceBusManager->get(Definition::EVENT_RECEIVER_LOADER); - $queue = $serviceBusManager->get('queue_manager')->get('local-queue'); + $queue = $serviceBusManager->get(Definition::QUEUE_LOADER)->get('local-queue'); - $messageDispatcher->registerCommandReceiverManagerForQueue($queue, $commandReceiverManager); - $messageDispatcher->registerEventReceiverManagerForQueue($queue, $eventReceiverManager); + $messageDispatcher->registerCommandReceiverLoaderForQueue($queue, $commandReceiverLoader); + $messageDispatcher->registerEventReceiverLoaderForQueue($queue, $eventReceiverLoader); $serviceBusManager->setAllowOverride(false); } diff --git a/src/Prooph/ServiceBus/Message/DefaultQueueFactory.php b/src/Prooph/ServiceBus/Message/DefaultQueueFactory.php index 0aeb217..8ce48d0 100644 --- a/src/Prooph/ServiceBus/Message/DefaultQueueFactory.php +++ b/src/Prooph/ServiceBus/Message/DefaultQueueFactory.php @@ -34,7 +34,7 @@ public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator { try { \Assert\that($requestedName)->notEmpty()->string(); - \Assert\that($serviceLocator)->isInstanceOf("Prooph\ServiceBus\Service\QueueManager"); + \Assert\that($serviceLocator)->isInstanceOf("Prooph\ServiceBus\Service\QueueLoader"); return true; } catch (\InvalidArgumentException $ex) { return false; diff --git a/src/Prooph/ServiceBus/Message/InMemoryMessageDispatcher.php b/src/Prooph/ServiceBus/Message/InMemoryMessageDispatcher.php index d6eb378..f9be3f6 100644 --- a/src/Prooph/ServiceBus/Message/InMemoryMessageDispatcher.php +++ b/src/Prooph/ServiceBus/Message/InMemoryMessageDispatcher.php @@ -12,9 +12,9 @@ namespace Prooph\ServiceBus\Message; use Prooph\ServiceBus\Exception\RuntimeException; -use Prooph\ServiceBus\Service\CommandReceiverManager; +use Prooph\ServiceBus\Service\CommandReceiverLoader; use Prooph\ServiceBus\Service\Definition; -use Prooph\ServiceBus\Service\EventReceiverManager; +use Prooph\ServiceBus\Service\EventReceiverLoader; use Zend\EventManager\EventManager; use Zend\EventManager\EventManagerInterface; @@ -27,14 +27,14 @@ class InMemoryMessageDispatcher implements MessageDispatcherInterface { /** - * @var CommandReceiverManager[] + * @var CommandReceiverLoader[] */ - protected $commandReceiverManagerQueueMap = array(); + protected $commandReceiverLoaderQueueMap = array(); /** - * @var EventReceiverManager[] + * @var EventReceiverLoader[] */ - protected $eventReceiverManagerQueueMap = array(); + protected $eventReceiverLoaderQueueMap = array(); /** * @var EventManagerInterface @@ -61,16 +61,16 @@ public function dispatch(QueueInterface $aQueue, MessageInterface $aMessage) } if ($aMessage->header()->type() === MessageHeader::TYPE_COMMAND) { - if (!isset($this->commandReceiverManagerQueueMap[$aQueue->name()])) { + if (!isset($this->commandReceiverLoaderQueueMap[$aQueue->name()])) { throw new RuntimeException( sprintf( - 'No CommandReceiverManager registered for queue -%s-', + 'No CommandReceiverLoader registered for queue -%s-', $aQueue->name() ) ); } - $commandReceiver = $this->commandReceiverManagerQueueMap[$aQueue->name()] + $commandReceiver = $this->commandReceiverLoaderQueueMap[$aQueue->name()] ->get($aMessage->header()->sender()); $commandReceiver->handle($aMessage); @@ -85,16 +85,16 @@ public function dispatch(QueueInterface $aQueue, MessageInterface $aMessage) } if ($aMessage->header()->type() === MessageHeader::TYPE_EVENT) { - if (!isset($this->eventReceiverManagerQueueMap[$aQueue->name()])) { + if (!isset($this->eventReceiverLoaderQueueMap[$aQueue->name()])) { throw new RuntimeException( sprintf( - 'No EventReceiverManager registered for queue -%s-', + 'No EventReceiverLoader registered for queue -%s-', $aQueue->name() ) ); } - $eventReceiver = $this->eventReceiverManagerQueueMap[$aQueue->name()] + $eventReceiver = $this->eventReceiverLoaderQueueMap[$aQueue->name()] ->get($aMessage->header()->sender()); $eventReceiver->handle($aMessage); @@ -111,24 +111,24 @@ public function dispatch(QueueInterface $aQueue, MessageInterface $aMessage) /** * @param QueueInterface $aQueue - * @param CommandReceiverManager $aCommandReceiverManager + * @param CommandReceiverLoader $aCommandReceiverLoader */ - public function registerCommandReceiverManagerForQueue( + public function registerCommandReceiverLoaderForQueue( QueueInterface $aQueue, - CommandReceiverManager $aCommandReceiverManager + CommandReceiverLoader $aCommandReceiverLoader ) { - $this->commandReceiverManagerQueueMap[$aQueue->name()] = $aCommandReceiverManager; + $this->commandReceiverLoaderQueueMap[$aQueue->name()] = $aCommandReceiverLoader; } /** * @param QueueInterface $aQueue - * @param EventReceiverManager $anEventReceiverManager + * @param EventReceiverLoader $anEventReceiverLoader */ - public function registerEventReceiverManagerForQueue( + public function registerEventReceiverLoaderForQueue( QueueInterface $aQueue, - EventReceiverManager $anEventReceiverManager + EventReceiverLoader $anEventReceiverLoader ) { - $this->eventReceiverManagerQueueMap[$aQueue->name()] = $anEventReceiverManager; + $this->eventReceiverLoaderQueueMap[$aQueue->name()] = $anEventReceiverLoader; } /** diff --git a/src/Prooph/ServiceBus/Message/PhpResque/PhpResqueReceiverJob.php b/src/Prooph/ServiceBus/Message/PhpResque/PhpResqueReceiverJob.php index 819f854..38ac975 100644 --- a/src/Prooph/ServiceBus/Message/PhpResque/PhpResqueReceiverJob.php +++ b/src/Prooph/ServiceBus/Message/PhpResque/PhpResqueReceiverJob.php @@ -52,11 +52,11 @@ public function perform() if ($message->header()->type() === MessageHeader::TYPE_COMMAND) { $receiver = $this->serviceBusManager - ->get(Definition::COMMAND_RECEIVER_MANAGER) + ->get(Definition::COMMAND_RECEIVER_LOADER) ->get($message->header()->sender()); } else { $receiver = $this->serviceBusManager - ->get(Definition::EVENT_RECEIVER_MANAGER) + ->get(Definition::EVENT_RECEIVER_LOADER) ->get($message->header()->sender()); } diff --git a/src/Prooph/ServiceBus/Service/CommandBusManager.php b/src/Prooph/ServiceBus/Service/CommandBusLoader.php similarity index 95% rename from src/Prooph/ServiceBus/Service/CommandBusManager.php rename to src/Prooph/ServiceBus/Service/CommandBusLoader.php index f569f21..fdabad9 100644 --- a/src/Prooph/ServiceBus/Service/CommandBusManager.php +++ b/src/Prooph/ServiceBus/Service/CommandBusLoader.php @@ -19,12 +19,12 @@ use Zend\ServiceManager\Exception; /** - * Class CommandBusManager + * Class CommandBusLoader * * @package Prooph\ServiceBus\Service * @author Alexander Miertsch */ -class CommandBusManager extends AbstractPluginManager +class CommandBusLoader extends AbstractPluginManager { /** * @param ConfigInterface $aConfig diff --git a/src/Prooph/ServiceBus/Service/CommandReceiverManager.php b/src/Prooph/ServiceBus/Service/CommandReceiverLoader.php similarity index 94% rename from src/Prooph/ServiceBus/Service/CommandReceiverManager.php rename to src/Prooph/ServiceBus/Service/CommandReceiverLoader.php index c3455fb..07a144b 100644 --- a/src/Prooph/ServiceBus/Service/CommandReceiverManager.php +++ b/src/Prooph/ServiceBus/Service/CommandReceiverLoader.php @@ -18,14 +18,14 @@ use Zend\ServiceManager\Exception; /** - * Class CommandReceiverManager + * Class CommandReceiverLoader * * @method CommandReceiverInterface get($name) Get CommandReceiver by name or alias * * @package Prooph\ServiceBus\Service * @author Alexander Miertsch */ -class CommandReceiverManager extends AbstractPluginManager +class CommandReceiverLoader extends AbstractPluginManager { /** * @param ConfigInterface $aConfig diff --git a/src/Prooph/ServiceBus/Service/Definition.php b/src/Prooph/ServiceBus/Service/Definition.php index 477215b..779e3e0 100644 --- a/src/Prooph/ServiceBus/Service/Definition.php +++ b/src/Prooph/ServiceBus/Service/Definition.php @@ -49,19 +49,19 @@ class Definition const MESSAGE_FACTORY = "message_factory"; - const COMMAND_BUS_MANAGER = "command_bus_manager"; + const COMMAND_BUS_LOADER = "command_bus_loader"; - const COMMAND_RECEIVER_MANAGER = "command_receiver_manager"; + const COMMAND_RECEIVER_LOADER = "command_receiver_loader"; - const EVENT_BUS_MANAGER = "event_bus_manager"; + const EVENT_BUS_LOADER = "event_bus_loader"; - const EVENT_RECEIVER_MANAGER = "event_receiver_manager"; + const EVENT_RECEIVER_LOADER = "event_receiver_loader"; - const INVOKE_STRATEGY_MANAGER = "invoke_strategy_manager"; + const INVOKE_STRATEGY_LOADER = "invoke_strategy_loader"; - const MESSAGE_DISPATCHER_MANAGER = "message_dispatcher_manager"; + const MESSAGE_DISPATCHER_LOADER = "message_dispatcher_loader"; - const QUEUE_MANAGER = "queue_manager"; + const QUEUE_LOADER = "queue_loader"; const SERVICE_BUS_COMPONENT = 'service_bus_component'; } diff --git a/src/Prooph/ServiceBus/Service/EventBusManager.php b/src/Prooph/ServiceBus/Service/EventBusLoader.php similarity index 95% rename from src/Prooph/ServiceBus/Service/EventBusManager.php rename to src/Prooph/ServiceBus/Service/EventBusLoader.php index aa968c5..b76d0ec 100644 --- a/src/Prooph/ServiceBus/Service/EventBusManager.php +++ b/src/Prooph/ServiceBus/Service/EventBusLoader.php @@ -19,12 +19,12 @@ use Zend\ServiceManager\Exception; /** - * Class EventBusManager + * Class EventBusLoader * * @package Prooph\ServiceBus\Service * @author Alexander Miertsch */ -class EventBusManager extends AbstractPluginManager +class EventBusLoader extends AbstractPluginManager { /** * @param ConfigInterface $aConfig diff --git a/src/Prooph/ServiceBus/Service/EventReceiverManager.php b/src/Prooph/ServiceBus/Service/EventReceiverLoader.php similarity index 94% rename from src/Prooph/ServiceBus/Service/EventReceiverManager.php rename to src/Prooph/ServiceBus/Service/EventReceiverLoader.php index 42b2727..3bdb651 100644 --- a/src/Prooph/ServiceBus/Service/EventReceiverManager.php +++ b/src/Prooph/ServiceBus/Service/EventReceiverLoader.php @@ -17,14 +17,14 @@ use Zend\ServiceManager\ConfigInterface; /** - * Class EventReceiverManager + * Class EventReceiverLoader * * @method EventReceiverInterface get($name) Get EventReceiver by name or alias * * @package Prooph\ServiceBus\Service * @author Alexander Miertsch */ -class EventReceiverManager extends AbstractPluginManager +class EventReceiverLoader extends AbstractPluginManager { /** * @param ConfigInterface $aConfig diff --git a/src/Prooph/ServiceBus/Service/InvokeStrategyManager.php b/src/Prooph/ServiceBus/Service/InvokeStrategyLoader.php similarity index 94% rename from src/Prooph/ServiceBus/Service/InvokeStrategyManager.php rename to src/Prooph/ServiceBus/Service/InvokeStrategyLoader.php index 6994abf..ed6fb20 100644 --- a/src/Prooph/ServiceBus/Service/InvokeStrategyManager.php +++ b/src/Prooph/ServiceBus/Service/InvokeStrategyLoader.php @@ -17,12 +17,12 @@ use Zend\ServiceManager\Exception; /** - * Class InvokeStrategyManager + * Class InvokeStrategyLoader * * @package Prooph\ServiceBus\Service * @author Alexander Miertsch */ -class InvokeStrategyManager extends AbstractPluginManager +class InvokeStrategyLoader extends AbstractPluginManager { /** * @var array diff --git a/src/Prooph/ServiceBus/Service/MessageDispatcherManager.php b/src/Prooph/ServiceBus/Service/MessageDispatcherLoader.php similarity index 94% rename from src/Prooph/ServiceBus/Service/MessageDispatcherManager.php rename to src/Prooph/ServiceBus/Service/MessageDispatcherLoader.php index 0d31581..4e65d55 100644 --- a/src/Prooph/ServiceBus/Service/MessageDispatcherManager.php +++ b/src/Prooph/ServiceBus/Service/MessageDispatcherLoader.php @@ -17,14 +17,14 @@ use Zend\ServiceManager\Exception; /** - * Class MessageDispatcherManager + * Class MessageDispatcherLoader * * @method MessageDispatcherInterface get($name) Get MessageDispatcher by name or alias * * @package Prooph\ServiceBus\Service * @author Alexander Miertsch */ -class MessageDispatcherManager extends AbstractPluginManager +class MessageDispatcherLoader extends AbstractPluginManager { protected $invokableClasses = array( 'inmemorymessagedispatcher' => 'Prooph\ServiceBus\Message\InMemoryMessageDispatcher', diff --git a/src/Prooph/ServiceBus/Service/QueueManager.php b/src/Prooph/ServiceBus/Service/QueueLoader.php similarity index 95% rename from src/Prooph/ServiceBus/Service/QueueManager.php rename to src/Prooph/ServiceBus/Service/QueueLoader.php index 0763f55..d0eb11c 100644 --- a/src/Prooph/ServiceBus/Service/QueueManager.php +++ b/src/Prooph/ServiceBus/Service/QueueLoader.php @@ -18,14 +18,14 @@ use Zend\ServiceManager\ConfigInterface; /** - * Class QueueManager + * Class QueueLoader * * @method QueueInterface get($name) Get Queue by name or alias * * @package Prooph\ServiceBus\Service * @author Alexander Miertsch */ -class QueueManager extends AbstractPluginManager +class QueueLoader extends AbstractPluginManager { /** * @param ConfigInterface $aConfig diff --git a/src/Prooph/ServiceBus/Service/ServiceBusConfiguration.php b/src/Prooph/ServiceBus/Service/ServiceBusConfiguration.php index 54fe940..a399565 100644 --- a/src/Prooph/ServiceBus/Service/ServiceBusConfiguration.php +++ b/src/Prooph/ServiceBus/Service/ServiceBusConfiguration.php @@ -46,12 +46,12 @@ class ServiceBusConfiguration implements ConfigInterface /** * @var ServiceLocatorInterface */ - protected $invokeStrategyManager; + protected $invokeStrategyLoader; /** * @var ServiceLocatorInterface */ - protected $commandReceiverManager; + protected $commandReceiverLoader; /** * @param null|array $aConfiguration @@ -89,12 +89,12 @@ public function configureServiceManager(ServiceManager $serviceManager) $serviceManager->setService(Definition::COMMAND_FACTORY, $this->commandFactory); } - if (!is_null($this->invokeStrategyManager)) { - $serviceManager->setService(Definition::INVOKE_STRATEGY_MANAGER, $this->invokeStrategyManager); + if (!is_null($this->invokeStrategyLoader)) { + $serviceManager->setService(Definition::INVOKE_STRATEGY_LOADER, $this->invokeStrategyLoader); } - if (!is_null($this->commandReceiverManager)) { - $serviceManager->setService(Definition::COMMAND_RECEIVER_MANAGER, $this->commandReceiverManager); + if (!is_null($this->commandReceiverLoader)) { + $serviceManager->setService(Definition::COMMAND_RECEIVER_LOADER, $this->commandReceiverLoader); } if (isset($this->configuration[Definition::CONFIG_ROOT][Definition::DEFAULT_COMMAND_BUS])) { @@ -189,19 +189,19 @@ public function setCommandFactory(CommandFactoryInterface $commandFactory) } /** - * @param ServiceLocatorInterface $commandReceiverManager + * @param ServiceLocatorInterface $commandReceiverLoader */ - public function setCommandReceiverManager(ServiceLocatorInterface $commandReceiverManager) + public function setCommandReceiverLoader(ServiceLocatorInterface $commandReceiverLoader) { - $this->commandReceiverManager = $commandReceiverManager; + $this->commandReceiverLoader = $commandReceiverLoader; } /** - * @param ServiceLocatorInterface $invokeStrategyManager + * @param ServiceLocatorInterface $invokeStrategyLoader */ - public function setInvokeStrategyManager(ServiceLocatorInterface $invokeStrategyManager) + public function setInvokeStrategyLoader(ServiceLocatorInterface $invokeStrategyLoader) { - $this->invokeStrategyManager = $invokeStrategyManager; + $this->invokeStrategyLoader = $invokeStrategyLoader; } } \ No newline at end of file diff --git a/src/Prooph/ServiceBus/Service/ServiceBusManager.php b/src/Prooph/ServiceBus/Service/ServiceBusManager.php index fc1e710..564758b 100644 --- a/src/Prooph/ServiceBus/Service/ServiceBusManager.php +++ b/src/Prooph/ServiceBus/Service/ServiceBusManager.php @@ -64,13 +64,13 @@ class ServiceBusManager extends ServiceManager * @var array */ protected $invokableClasses = array( - 'commandbusmanager' => 'Prooph\ServiceBus\Service\CommandBusManager', - 'commandreceivermanager' => 'Prooph\ServiceBus\Service\CommandReceiverManager', - 'invokestrategymanager' => 'Prooph\ServiceBus\Service\InvokeStrategyManager', - 'messagedispatchermanager' => 'Prooph\ServiceBus\Service\MessageDispatcherManager', - 'queuemanager' => 'Prooph\ServiceBus\Service\QueueManager', - 'eventreceivermanager' => 'Prooph\ServiceBus\Service\EventReceiverManager', - 'eventbusmanager' => 'Prooph\ServiceBus\Service\EventBusManager', + 'commandbusloader' => 'Prooph\ServiceBus\Service\CommandBusLoader', + 'commandreceiverloader' => 'Prooph\ServiceBus\Service\CommandReceiverLoader', + 'invokestrategyloader' => 'Prooph\ServiceBus\Service\InvokeStrategyLoader', + 'messagedispatcherloader' => 'Prooph\ServiceBus\Service\MessageDispatcherLoader', + 'queueloader' => 'Prooph\ServiceBus\Service\QueueLoader', + 'eventreceiverloader' => 'Prooph\ServiceBus\Service\EventReceiverLoader', + 'eventbusloader' => 'Prooph\ServiceBus\Service\EventBusLoader', ); /** @@ -191,10 +191,10 @@ public function getCommandBus($aName = null) ); } - return $this->get('commandbusmanager')->get($this->defaultCommandBus); + return $this->get(Definition::COMMAND_BUS_LOADER)->get($this->defaultCommandBus); } - return $this->get('commandbusmanager')->get($aName); + return $this->get(Definition::COMMAND_BUS_LOADER)->get($aName); } /** @@ -246,10 +246,10 @@ public function getEventBus($aName = null) ); } - return $this->get('eventbusmanager')->get($this->defaultEventBus); + return $this->get(Definition::EVENT_BUS_LOADER)->get($this->defaultEventBus); } - return $this->get('eventbusmanager')->get($aName); + return $this->get(Definition::EVENT_BUS_LOADER)->get($aName); } /** diff --git a/tests/Prooph/ServiceBusTest/Command/CommandBusTest.php b/tests/Prooph/ServiceBusTest/Command/CommandBusTest.php index e769fb7..25f1d4e 100644 --- a/tests/Prooph/ServiceBusTest/Command/CommandBusTest.php +++ b/tests/Prooph/ServiceBusTest/Command/CommandBusTest.php @@ -16,7 +16,7 @@ use Prooph\ServiceBus\Message\InMemoryMessageDispatcher; use Prooph\ServiceBus\Message\MessageFactory; use Prooph\ServiceBus\Message\Queue; -use Prooph\ServiceBus\Service\CommandReceiverManager; +use Prooph\ServiceBus\Service\CommandReceiverLoader; use Prooph\ServiceBus\Service\ServiceBusManager; use Prooph\ServiceBusTest\Mock\DoSomething; use Prooph\ServiceBusTest\Mock\HandleCommandHandler; @@ -61,11 +61,11 @@ protected function setUp() $serviceBusManager ); - $commandReceiverManager = new CommandReceiverManager(); + $commandReceiverLoader = new CommandReceiverLoader(); - $commandReceiverManager->setService('test-case-bus', $commandReceiver); + $commandReceiverLoader->setService('test-case-bus', $commandReceiver); - $messageDispatcher->registerCommandReceiverManagerForQueue($queue, $commandReceiverManager); + $messageDispatcher->registerCommandReceiverLoaderForQueue($queue, $commandReceiverLoader); $this->commandBus = new CommandBus('test-case-bus', $messageDispatcher, $queue); } diff --git a/tests/Prooph/ServiceBusTest/Command/DefaultCommandBusFactoryTest.php b/tests/Prooph/ServiceBusTest/Command/DefaultCommandBusFactoryTest.php index 5c9b4e1..cf814d8 100644 --- a/tests/Prooph/ServiceBusTest/Command/DefaultCommandBusFactoryTest.php +++ b/tests/Prooph/ServiceBusTest/Command/DefaultCommandBusFactoryTest.php @@ -13,7 +13,7 @@ use Prooph\ServiceBus\Command\DefaultCommandBusFactory; use Prooph\ServiceBus\Message\Queue; -use Prooph\ServiceBus\Service\CommandBusManager; +use Prooph\ServiceBus\Service\CommandBusLoader; use Prooph\ServiceBus\Service\Definition; use Prooph\ServiceBus\Service\ServiceBusManager; use Prooph\ServiceBusTest\Mock\DoSomething; @@ -67,12 +67,12 @@ protected function setUp() //Register DoSomethingHandler as Service $this->serviceBusManager->setService('do_something_handler', $this->doSomethingHandler); - $inMemoryMessageDispatcher = $this->serviceBusManager->get(Definition::MESSAGE_DISPATCHER_MANAGER) + $inMemoryMessageDispatcher = $this->serviceBusManager->get(Definition::MESSAGE_DISPATCHER_LOADER) ->get(Definition::IN_MEMORY_MESSAGE_DISPATCHER); - $inMemoryMessageDispatcher->registerCommandReceiverManagerForQueue( + $inMemoryMessageDispatcher->registerCommandReceiverLoaderForQueue( new Queue('local'), - $this->serviceBusManager->get(Definition::COMMAND_RECEIVER_MANAGER) + $this->serviceBusManager->get(Definition::COMMAND_RECEIVER_LOADER) ); } @@ -81,12 +81,12 @@ protected function setUp() */ public function it_creates_a_fully_configured_command_bus() { - $commandBusManager = new CommandBusManager(); - $commandBusManager->setServiceLocator($this->serviceBusManager); + $commandBusLoader = new CommandBusLoader(); + $commandBusLoader->setServiceLocator($this->serviceBusManager); $factory = new DefaultCommandBusFactory(); - $commandBus = $factory->createServiceWithName($commandBusManager, 'testcasebus', 'test-case-bus'); + $commandBus = $factory->createServiceWithName($commandBusLoader, 'testcasebus', 'test-case-bus'); $doSomething = DoSomething::fromData('test payload'); diff --git a/tests/Prooph/ServiceBusTest/Command/DefaultCommandReceiverFactoryTest.php b/tests/Prooph/ServiceBusTest/Command/DefaultCommandReceiverFactoryTest.php index 09c9285..a95b0d3 100644 --- a/tests/Prooph/ServiceBusTest/Command/DefaultCommandReceiverFactoryTest.php +++ b/tests/Prooph/ServiceBusTest/Command/DefaultCommandReceiverFactoryTest.php @@ -15,9 +15,9 @@ use Prooph\ServiceBus\Command\DefaultCommandReceiverFactory; use Prooph\ServiceBus\Message\MessageHeader; use Prooph\ServiceBus\Message\StandardMessage; -use Prooph\ServiceBus\Service\CommandReceiverManager; +use Prooph\ServiceBus\Service\CommandReceiverLoader; use Prooph\ServiceBus\Service\Definition; -use Prooph\ServiceBus\Service\InvokeStrategyManager; +use Prooph\ServiceBus\Service\InvokeStrategyLoader; use Prooph\ServiceBus\Service\ServiceBusManager; use Prooph\ServiceBusTest\Mock\DoSomethingHandler; use Prooph\ServiceBusTest\Mock\DoSomethingInvokeStrategy; @@ -43,9 +43,9 @@ class DefaultCommandReceiverFactoryTest extends TestCase private $doSomethingHandler; /** - * @var CommandReceiverManager + * @var CommandReceiverLoader */ - private $commandReceiverManager; + private $commandReceiverLoader; protected function setUp() { @@ -78,23 +78,23 @@ protected function setUp() //Register DoSomethingHandler as Service $this->serviceBusManager->setService('do_something_handler', $this->doSomethingHandler); - $invokeStrategyManager = new InvokeStrategyManager(); + $invokeStrategyLoader = new InvokeStrategyLoader(); //Register DoSomethingInvokeStrategy as Service - $invokeStrategyManager->setService('do_something_invoke_strategy', new DoSomethingInvokeStrategy()); + $invokeStrategyLoader->setService('do_something_invoke_strategy', new DoSomethingInvokeStrategy()); $this->serviceBusManager->setAllowOverride(true); - //Register InvokeStrategyManager as Service - $this->serviceBusManager->setService(Definition::INVOKE_STRATEGY_MANAGER, $invokeStrategyManager); + //Register InvokeStrategyLoader as Service + $this->serviceBusManager->setService(Definition::INVOKE_STRATEGY_LOADER, $invokeStrategyLoader); //Register CommandFactory as Service, this is not necessary but we do it for testing purposes $this->serviceBusManager->setService(Definition::COMMAND_FACTORY, new CommandFactory()); - $this->commandReceiverManager = new CommandReceiverManager(); + $this->commandReceiverLoader = new CommandReceiverLoader(); - //Set MainServiceManager as ServiceLocator for the CommandReceiverManager - $this->commandReceiverManager->setServiceLocator($this->serviceBusManager); + //Set MainServiceManager as ServiceLocator for the CommandReceiverLoader + $this->commandReceiverLoader->setServiceLocator($this->serviceBusManager); } /** @@ -106,7 +106,7 @@ public function it_can_create_a_command_receiver() $this->assertTrue( $defaultCommandReceiverFactory - ->canCreateServiceWithName($this->commandReceiverManager, 'testcasebus', 'test-case-bus') + ->canCreateServiceWithName($this->commandReceiverLoader, 'testcasebus', 'test-case-bus') ); } @@ -118,7 +118,7 @@ public function it_creates_a_fully_configured_command_receiver() $defaultCommandReceiverFactory = new DefaultCommandReceiverFactory(); $commandReceiver = $defaultCommandReceiverFactory - ->createServiceWithName($this->commandReceiverManager, 'testcasebus', 'test-case-bus'); + ->createServiceWithName($this->commandReceiverLoader, 'testcasebus', 'test-case-bus'); $this->assertSame( $this->serviceBusManager->get(Definition::COMMAND_FACTORY), @@ -126,8 +126,8 @@ public function it_creates_a_fully_configured_command_receiver() ); $this->assertSame( - $this->serviceBusManager->get(Definition::INVOKE_STRATEGY_MANAGER), - $commandReceiver->getInvokeStrategyManager() + $this->serviceBusManager->get(Definition::INVOKE_STRATEGY_LOADER), + $commandReceiver->getInvokeStrategyLoader() ); $this->assertEquals( diff --git a/tests/Prooph/ServiceBusTest/Event/DefaultEventBusFactoryTest.php b/tests/Prooph/ServiceBusTest/Event/DefaultEventBusFactoryTest.php index a109a55..4e3a6a5 100644 --- a/tests/Prooph/ServiceBusTest/Event/DefaultEventBusFactoryTest.php +++ b/tests/Prooph/ServiceBusTest/Event/DefaultEventBusFactoryTest.php @@ -14,7 +14,7 @@ use Prooph\ServiceBus\Event\DefaultEventBusFactory; use Prooph\ServiceBus\Message\Queue; use Prooph\ServiceBus\Service\Definition; -use Prooph\ServiceBus\Service\EventBusManager; +use Prooph\ServiceBus\Service\EventBusLoader; use Prooph\ServiceBus\Service\ServiceBusManager; use Prooph\ServiceBusTest\Mock\OnEventHandler; use Prooph\ServiceBusTest\Mock\SomethingDone; @@ -68,17 +68,17 @@ protected function setUp() //Register DoSomethingHandler as Service $this->serviceBusManager->setService('something_done_handler', $this->somethingDoneHandler); - $inMemoryMessageDispatcher = $this->serviceBusManager->get(Definition::MESSAGE_DISPATCHER_MANAGER) + $inMemoryMessageDispatcher = $this->serviceBusManager->get(Definition::MESSAGE_DISPATCHER_LOADER) ->get(Definition::IN_MEMORY_MESSAGE_DISPATCHER); - $inMemoryMessageDispatcher->registerEventReceiverManagerForQueue( + $inMemoryMessageDispatcher->registerEventReceiverLoaderForQueue( new Queue('local'), - $this->serviceBusManager->get(Definition::EVENT_RECEIVER_MANAGER) + $this->serviceBusManager->get(Definition::EVENT_RECEIVER_LOADER) ); - $inMemoryMessageDispatcher->registerEventReceiverManagerForQueue( + $inMemoryMessageDispatcher->registerEventReceiverLoaderForQueue( new Queue('local-2'), - $this->serviceBusManager->get(Definition::EVENT_RECEIVER_MANAGER) + $this->serviceBusManager->get(Definition::EVENT_RECEIVER_LOADER) ); } @@ -87,12 +87,12 @@ protected function setUp() */ public function it_creates_a_fully_configured_event_bus() { - $eventBusManager = new EventBusManager(); - $eventBusManager->setServiceLocator($this->serviceBusManager); + $eventBusLoader = new EventBusLoader(); + $eventBusLoader->setServiceLocator($this->serviceBusManager); $factory = new DefaultEventBusFactory(); - $eventBus = $factory->createServiceWithName($eventBusManager, 'testcasebus', 'test-case-bus'); + $eventBus = $factory->createServiceWithName($eventBusLoader, 'testcasebus', 'test-case-bus'); $somethingDone = SomethingDone::fromData('test payload'); diff --git a/tests/Prooph/ServiceBusTest/Event/DefaultEventReceiverFactoryTest.php b/tests/Prooph/ServiceBusTest/Event/DefaultEventReceiverFactoryTest.php index 2697c6f..2807752 100644 --- a/tests/Prooph/ServiceBusTest/Event/DefaultEventReceiverFactoryTest.php +++ b/tests/Prooph/ServiceBusTest/Event/DefaultEventReceiverFactoryTest.php @@ -16,8 +16,8 @@ use Prooph\ServiceBus\Message\MessageHeader; use Prooph\ServiceBus\Message\StandardMessage; use Prooph\ServiceBus\Service\Definition; -use Prooph\ServiceBus\Service\EventReceiverManager; -use Prooph\ServiceBus\Service\InvokeStrategyManager; +use Prooph\ServiceBus\Service\EventReceiverLoader; +use Prooph\ServiceBus\Service\InvokeStrategyLoader; use Prooph\ServiceBus\Service\ServiceBusManager; use Prooph\ServiceBusTest\Mock\SomethingDoneHandler; use Prooph\ServiceBusTest\Mock\SomethingDoneInvokeStrategy; @@ -43,9 +43,9 @@ class DefaultEventReceiverFactoryTest extends TestCase private $somethingDoneHandler; /** - * @var EventReceiverManager + * @var EventReceiverLoader */ - private $eventReceiverManager; + private $eventReceiverLoader; protected function setUp() { @@ -78,23 +78,23 @@ protected function setUp() //Register SomethingDoneHandler as Service $this->serviceBusManager->setService('something_done_handler', $this->somethingDoneHandler); - $invokeStrategyManager = new InvokeStrategyManager(); + $invokeStrategyLoader = new InvokeStrategyLoader(); //Register DoSomethingInvokeStrategy as Service - $invokeStrategyManager->setService('something_done_invoke_strategy', new SomethingDoneInvokeStrategy()); + $invokeStrategyLoader->setService('something_done_invoke_strategy', new SomethingDoneInvokeStrategy()); $this->serviceBusManager->setAllowOverride(true); - //Register InvokeStrategyManager as Service - $this->serviceBusManager->setService(Definition::INVOKE_STRATEGY_MANAGER, $invokeStrategyManager); + //Register InvokeStrategyLoader as Service + $this->serviceBusManager->setService(Definition::INVOKE_STRATEGY_LOADER, $invokeStrategyLoader); //Register EventFactory as Service, this is not necessary but we do it for testing purposes $this->serviceBusManager->setService(Definition::EVENT_FACTORY, new EventFactory()); - $this->eventReceiverManager = new EventReceiverManager(); + $this->eventReceiverLoader = new EventReceiverLoader(); - //Set MainServiceManager as ServiceLocator for the CommandReceiverManager - $this->eventReceiverManager->setServiceLocator($this->serviceBusManager); + //Set MainServiceManager as ServiceLocator for the CommandReceiverLoader + $this->eventReceiverLoader->setServiceLocator($this->serviceBusManager); } /** @@ -106,7 +106,7 @@ public function it_can_create_an_event_receiver() $this->assertTrue( $defaultEventReceiverFactory - ->canCreateServiceWithName($this->eventReceiverManager, 'testcasebus', 'test-case-bus') + ->canCreateServiceWithName($this->eventReceiverLoader, 'testcasebus', 'test-case-bus') ); } @@ -118,7 +118,7 @@ public function it_creates_a_fully_configured_event_receiver() $defaultEventReceiverFactory = new DefaultEventReceiverFactory(); $eventReceiver = $defaultEventReceiverFactory - ->createServiceWithName($this->eventReceiverManager, 'testcasebus', 'test-case-bus'); + ->createServiceWithName($this->eventReceiverLoader, 'testcasebus', 'test-case-bus'); $this->assertSame( $this->serviceBusManager->get(Definition::EVENT_FACTORY), @@ -126,8 +126,8 @@ public function it_creates_a_fully_configured_event_receiver() ); $this->assertSame( - $this->serviceBusManager->get(Definition::INVOKE_STRATEGY_MANAGER), - $eventReceiver->getInvokeStrategyManager() + $this->serviceBusManager->get(Definition::INVOKE_STRATEGY_LOADER), + $eventReceiver->getInvokeStrategyLoader() ); $this->assertEquals( diff --git a/tests/Prooph/ServiceBusTest/Event/EventBusTest.php b/tests/Prooph/ServiceBusTest/Event/EventBusTest.php index 72a1635..dc8c4b5 100644 --- a/tests/Prooph/ServiceBusTest/Event/EventBusTest.php +++ b/tests/Prooph/ServiceBusTest/Event/EventBusTest.php @@ -16,8 +16,8 @@ use Prooph\ServiceBus\Message\InMemoryMessageDispatcher; use Prooph\ServiceBus\Message\MessageFactory; use Prooph\ServiceBus\Message\Queue; -use Prooph\ServiceBus\Service\EventBusManager; -use Prooph\ServiceBus\Service\EventReceiverManager; +use Prooph\ServiceBus\Service\EventBusLoader; +use Prooph\ServiceBus\Service\EventReceiverLoader; use Prooph\ServiceBus\Service\ServiceBusManager; use Prooph\ServiceBusTest\Mock\OnEventHandler; use Prooph\ServiceBusTest\Mock\SomethingDone; @@ -63,12 +63,12 @@ protected function setUp() $serviceBusManager ); - $eventReceiverManager = new EventReceiverManager(); + $eventReceiverLoader = new EventReceiverLoader(); - $eventReceiverManager->setService('test-case-bus', $eventReceiver); + $eventReceiverLoader->setService('test-case-bus', $eventReceiver); - $messageDispatcher->registerEventReceiverManagerForQueue($queue, $eventReceiverManager); - $messageDispatcher->registerEventReceiverManagerForQueue($queue2, $eventReceiverManager); + $messageDispatcher->registerEventReceiverLoaderForQueue($queue, $eventReceiverLoader); + $messageDispatcher->registerEventReceiverLoaderForQueue($queue2, $eventReceiverLoader); $this->eventBus = new EventBus('test-case-bus', $messageDispatcher, array($queue, $queue2)); } diff --git a/tests/Prooph/ServiceBusTest/Message/InMemoryMessageDispatcherTest.php b/tests/Prooph/ServiceBusTest/Message/InMemoryMessageDispatcherTest.php index cfa745a..a1d8470 100644 --- a/tests/Prooph/ServiceBusTest/Message/InMemoryMessageDispatcherTest.php +++ b/tests/Prooph/ServiceBusTest/Message/InMemoryMessageDispatcherTest.php @@ -60,9 +60,9 @@ protected function setUp() $localQueue = new Queue('local'); - $this->messageDispatcher->registerCommandReceiverManagerForQueue( + $this->messageDispatcher->registerCommandReceiverLoaderForQueue( $localQueue, - $serviceBus->get(Definition::COMMAND_RECEIVER_MANAGER) + $serviceBus->get(Definition::COMMAND_RECEIVER_LOADER) ); } diff --git a/tests/Prooph/ServiceBusTest/Mock/DoSomethingInvokeStrategy.php b/tests/Prooph/ServiceBusTest/Mock/DoSomethingInvokeStrategy.php index 1569fa3..be48559 100644 --- a/tests/Prooph/ServiceBusTest/Mock/DoSomethingInvokeStrategy.php +++ b/tests/Prooph/ServiceBusTest/Mock/DoSomethingInvokeStrategy.php @@ -11,7 +11,6 @@ namespace Prooph\ServiceBusTest\Mock; -use Prooph\ServiceBus\Command\CommandInterface; use Prooph\ServiceBus\InvokeStrategy\InvokeStrategyInterface; /** @@ -23,8 +22,8 @@ class DoSomethingInvokeStrategy implements InvokeStrategyInterface { /** - * @param mixed $aHandler - * @param CommandInterface $aCommandOrEvent + * @param mixed $aHandler + * @param mixed $aCommandOrEvent * @return bool */ public function canInvoke($aHandler, $aCommandOrEvent) @@ -33,8 +32,8 @@ public function canInvoke($aHandler, $aCommandOrEvent) } /** - * @param mixed $aHandler - * @param CommandInterface $aCommandOrEvent + * @param mixed $aHandler + * @param mixed $aCommandOrEvent */ public function invoke($aHandler, $aCommandOrEvent) { diff --git a/tests/Prooph/ServiceBusTest/Mock/SomethingDoneInvokeStrategy.php b/tests/Prooph/ServiceBusTest/Mock/SomethingDoneInvokeStrategy.php index d103cf4..38ab8e7 100644 --- a/tests/Prooph/ServiceBusTest/Mock/SomethingDoneInvokeStrategy.php +++ b/tests/Prooph/ServiceBusTest/Mock/SomethingDoneInvokeStrategy.php @@ -11,8 +11,6 @@ namespace Prooph\ServiceBusTest\Mock; -use Prooph\ServiceBus\Command\CommandInterface; -use Prooph\ServiceBus\Event\EventInterface; use Prooph\ServiceBus\InvokeStrategy\InvokeStrategyInterface; /** @@ -25,7 +23,7 @@ class SomethingDoneInvokeStrategy implements InvokeStrategyInterface { /** * @param mixed $aHandler - * @param CommandInterface|EventInterface $aCommandOrEvent + * @param mixed $aCommandOrEvent * @return bool */ public function canInvoke($aHandler, $aCommandOrEvent) @@ -35,7 +33,7 @@ public function canInvoke($aHandler, $aCommandOrEvent) /** * @param mixed $aHandler - * @param CommandInterface|EventInterface $aCommandOrEvent + * @param mixed $aCommandOrEvent */ public function invoke($aHandler, $aCommandOrEvent) { diff --git a/tests/Prooph/ServiceBusTest/Service/CommandReceiverManagerTest.php b/tests/Prooph/ServiceBusTest/Service/CommandReceiverLoaderTest.php similarity index 80% rename from tests/Prooph/ServiceBusTest/Service/CommandReceiverManagerTest.php rename to tests/Prooph/ServiceBusTest/Service/CommandReceiverLoaderTest.php index cdb2d6a..69592e6 100644 --- a/tests/Prooph/ServiceBusTest/Service/CommandReceiverManagerTest.php +++ b/tests/Prooph/ServiceBusTest/Service/CommandReceiverLoaderTest.php @@ -11,18 +11,18 @@ namespace Prooph\ServiceBusTest\Service; -use Prooph\ServiceBus\Service\CommandReceiverManager; +use Prooph\ServiceBus\Service\CommandReceiverLoader; use Prooph\ServiceBus\Service\Definition; use Prooph\ServiceBus\Service\ServiceBusManager; use Prooph\ServiceBusTest\TestCase; /** - * Class CommandReceiverManagerTest + * Class CommandReceiverLoaderTest * * @package Prooph\ServiceBusTest\Service * @author Alexander Miertsch */ -class CommandReceiverManagerTest extends TestCase +class CommandReceiverLoaderTest extends TestCase { /** * @var ServiceBusManager @@ -30,9 +30,9 @@ class CommandReceiverManagerTest extends TestCase private $serviceBusManager; /** - * @var CommandReceiverManager + * @var CommandReceiverLoader */ - private $commandReceiverManager; + private $commandReceiverLoader; protected function setUp() { @@ -59,10 +59,10 @@ protected function setUp() //Add global config as service $this->serviceBusManager->setService('configuration', $config); - $this->commandReceiverManager = new CommandReceiverManager(); + $this->commandReceiverLoader = new CommandReceiverLoader(); - //Set MainServiceManager as ServiceLocator for the CommandReceiverManager - $this->commandReceiverManager->setServiceLocator($this->serviceBusManager); + //Set MainServiceManager as ServiceLocator for the CommandReceiverLoader + $this->commandReceiverLoader->setServiceLocator($this->serviceBusManager); } /** @@ -70,7 +70,7 @@ protected function setUp() */ public function it_returns_the_default_command_receiver() { - $commandReceiver = $this->commandReceiverManager->get('test-case-bus'); + $commandReceiver = $this->commandReceiverLoader->get('test-case-bus'); $this->assertInstanceOf('Prooph\ServiceBus\Command\CommandReceiver', $commandReceiver); } diff --git a/tests/Prooph/ServiceBusTest/Service/EventReceiverManagerTest.php b/tests/Prooph/ServiceBusTest/Service/EventReceiverLoaderTest.php similarity index 79% rename from tests/Prooph/ServiceBusTest/Service/EventReceiverManagerTest.php rename to tests/Prooph/ServiceBusTest/Service/EventReceiverLoaderTest.php index 75f43a8..a673b1c 100644 --- a/tests/Prooph/ServiceBusTest/Service/EventReceiverManagerTest.php +++ b/tests/Prooph/ServiceBusTest/Service/EventReceiverLoaderTest.php @@ -12,17 +12,17 @@ namespace Prooph\ServiceBusTest\Service; use Prooph\ServiceBus\Service\Definition; -use Prooph\ServiceBus\Service\EventReceiverManager; +use Prooph\ServiceBus\Service\EventReceiverLoader; use Prooph\ServiceBus\Service\ServiceBusManager; use Prooph\ServiceBusTest\TestCase; /** - * Class EventReceiverManagerTest + * Class EventReceiverLoaderTest * * @package Prooph\ServiceBusTest\Service * @author Alexander Miertsch */ -class EventReceiverManagerTest extends TestCase +class EventReceiverLoaderTest extends TestCase { /** * @var ServiceBusManager @@ -30,9 +30,9 @@ class EventReceiverManagerTest extends TestCase private $serviceBusManager; /** - * @var EventReceiverManager + * @var EventReceiverLoader */ - private $eventReceiverManager; + private $eventReceiverLoader; protected function setUp() { @@ -55,10 +55,10 @@ protected function setUp() //Add global config as service $this->serviceBusManager->setService('configuration', $config); - $this->eventReceiverManager = new EventReceiverManager(); + $this->eventReceiverLoader = new EventReceiverLoader(); - //Set MainServiceManager as ServiceLocator for the CommandReceiverManager - $this->eventReceiverManager->setServiceLocator($this->serviceBusManager); + //Set MainServiceManager as ServiceLocator for the CommandReceiverLoader + $this->eventReceiverLoader->setServiceLocator($this->serviceBusManager); } /** @@ -66,7 +66,7 @@ protected function setUp() */ public function it_returns_the_default_event_receiver() { - $eventReceiver = $this->eventReceiverManager->get('test-case-bus'); + $eventReceiver = $this->eventReceiverLoader->get('test-case-bus'); $this->assertInstanceOf('Prooph\ServiceBus\Event\EventReceiver', $eventReceiver); } diff --git a/tests/Prooph/ServiceBusTest/Service/InvokeStrategyManagerTest.php b/tests/Prooph/ServiceBusTest/Service/InvokeStrategyLoaderTest.php similarity index 66% rename from tests/Prooph/ServiceBusTest/Service/InvokeStrategyManagerTest.php rename to tests/Prooph/ServiceBusTest/Service/InvokeStrategyLoaderTest.php index 1b5bc4c..d0b7396 100644 --- a/tests/Prooph/ServiceBusTest/Service/InvokeStrategyManagerTest.php +++ b/tests/Prooph/ServiceBusTest/Service/InvokeStrategyLoaderTest.php @@ -11,25 +11,25 @@ namespace Prooph\ServiceBusTest\Service; -use Prooph\ServiceBus\Service\InvokeStrategyManager; +use Prooph\ServiceBus\Service\InvokeStrategyLoader; use Prooph\ServiceBusTest\TestCase; /** - * Class InvokeStrategyManagerTest + * Class InvokeStrategyLoaderTest * * @package Prooph\ServiceBusTest\Service * @author Alexander Miertsch */ -class InvokeStrategyManagerTest extends TestCase +class InvokeStrategyLoaderTest extends TestCase { /** * @test */ public function it_returns_a_callback_strategy() { - $invokeStrategyManager = new InvokeStrategyManager(); + $invokeStrategyLoader = new InvokeStrategyLoader(); - $callbackStrategy = $invokeStrategyManager->get('callback_strategy'); + $callbackStrategy = $invokeStrategyLoader->get('callback_strategy'); $this->assertInstanceOf('Prooph\ServiceBus\InvokeStrategy\CallbackStrategy', $callbackStrategy); } @@ -39,9 +39,9 @@ public function it_returns_a_callback_strategy() */ public function it_returns_a_handle_command_strategy() { - $invokeStrategyManager = new InvokeStrategyManager(); + $invokeStrategyLoader = new InvokeStrategyLoader(); - $handleCommandStrategy = $invokeStrategyManager->get('handle_command_strategy'); + $handleCommandStrategy = $invokeStrategyLoader->get('handle_command_strategy'); $this->assertInstanceOf('Prooph\ServiceBus\InvokeStrategy\HandleCommandStrategy', $handleCommandStrategy); } @@ -51,9 +51,9 @@ public function it_returns_a_handle_command_strategy() */ public function it_returns_a_on_event_strategy() { - $invokeStrategyManager = new InvokeStrategyManager(); + $invokeStrategyLoader = new InvokeStrategyLoader(); - $onEventStrategy = $invokeStrategyManager->get('on_event_strategy'); + $onEventStrategy = $invokeStrategyLoader->get('on_event_strategy'); $this->assertInstanceOf('Prooph\ServiceBus\InvokeStrategy\OnEventStrategy', $onEventStrategy); } diff --git a/tests/Prooph/ServiceBusTest/Service/MessageDispatcherManagerTest.php b/tests/Prooph/ServiceBusTest/Service/MessageDispatcherLoaderTest.php similarity index 65% rename from tests/Prooph/ServiceBusTest/Service/MessageDispatcherManagerTest.php rename to tests/Prooph/ServiceBusTest/Service/MessageDispatcherLoaderTest.php index d0d1163..5f5745b 100644 --- a/tests/Prooph/ServiceBusTest/Service/MessageDispatcherManagerTest.php +++ b/tests/Prooph/ServiceBusTest/Service/MessageDispatcherLoaderTest.php @@ -12,27 +12,27 @@ namespace Prooph\ServiceBusTest\Service; use Prooph\ServiceBus\Service\Definition; -use Prooph\ServiceBus\Service\MessageDispatcherManager; +use Prooph\ServiceBus\Service\MessageDispatcherLoader; use Prooph\ServiceBus\Service\ServiceBusManager; use Prooph\ServiceBusTest\TestCase; /** - * Class MessageDispatcherManagerTest + * Class MessageDispatcherLoaderTest * * @package Prooph\ServiceBusTest\Service * @author Alexander Miertsch */ -class MessageDispatcherManagerTest extends TestCase +class MessageDispatcherLoaderTest extends TestCase { /** * @test */ public function it_returns_an_in_memory_message_dispatcher() { - $messageDispatcherManager = new MessageDispatcherManager(); - $messageDispatcherManager->setServiceLocator(new ServiceBusManager()); + $messageDispatcherLoader = new MessageDispatcherLoader(); + $messageDispatcherLoader->setServiceLocator(new ServiceBusManager()); - $inMemoryMessageDispatcher = $messageDispatcherManager->get(Definition::IN_MEMORY_MESSAGE_DISPATCHER); + $inMemoryMessageDispatcher = $messageDispatcherLoader->get(Definition::IN_MEMORY_MESSAGE_DISPATCHER); $this->assertInstanceOf('Prooph\ServiceBus\Message\InMemoryMessageDispatcher', $inMemoryMessageDispatcher); } diff --git a/tests/Prooph/ServiceBusTest/Service/QueueManagerTest.php b/tests/Prooph/ServiceBusTest/Service/QueueLoaderTest.php similarity index 73% rename from tests/Prooph/ServiceBusTest/Service/QueueManagerTest.php rename to tests/Prooph/ServiceBusTest/Service/QueueLoaderTest.php index c498531..77f2e2b 100644 --- a/tests/Prooph/ServiceBusTest/Service/QueueManagerTest.php +++ b/tests/Prooph/ServiceBusTest/Service/QueueLoaderTest.php @@ -11,27 +11,27 @@ namespace Prooph\ServiceBusTest\Service; -use Prooph\ServiceBus\Service\QueueManager; +use Prooph\ServiceBus\Service\QueueLoader; use Prooph\ServiceBus\Service\ServiceBusManager; use Prooph\ServiceBusTest\TestCase; /** - * Class QueueManagerTest + * Class QueueLoaderTest * * @package Prooph\ServiceBusTest\Service * @author Alexander Miertsch */ -class QueueManagerTest extends TestCase +class QueueLoaderTest extends TestCase { /** * @test */ public function it_returns_a_valid_local_queue() { - $queueManager = new QueueManager(); - $queueManager->setServiceLocator(new ServiceBusManager()); + $queueLoader = new QueueLoader(); + $queueLoader->setServiceLocator(new ServiceBusManager()); - $localQueue = $queueManager->get('local'); + $localQueue = $queueLoader->get('local'); $this->assertInstanceOf('Prooph\ServiceBus\Message\QueueInterface', $localQueue); $this->assertEquals('local', $localQueue->name());