public function findHandlerMethod(AbstractAnnotatedSaga $target, EventMessageInterface $event) { foreach ($this->getMessageHandlers($event) as $handler) { $associationValue = $handler->getAssociationValue($event); if ($target->getAssociationValues()->contains($associationValue)) { return $handler; } } return SagaMethodMessageHandler::noHandlers(); /* for (SagaMethodMessageHandler handler : getMessageHandlers(event)) { final AssociationValue associationValue = handler.getAssociationValue(event); if (target.getAssociationValues().contains(associationValue)) { return handler; } else if (logger.isDebugEnabled()) { logger.debug( "Skipping handler [{}], it requires an association value [{}:{}] that this Saga is not associated with", handler.getName(), associationValue.getKey(), associationValue.getValue()); } } if (logger.isDebugEnabled()) { logger.debug("No suitable handler was found for event of type", event.getPayloadType().getName()); } return SagaMethodMessageHandler.noHandler(); */ }