sagaIds.addAll(sagaRepository.find(sagaType, associationValue));
}
for (String sagaId : sagaIds) {
if (ownedByCurrentProcessor(sagaId) && !processedSagas.containsKey(sagaId)) {
ensureActiveUnitOfWork();
final Saga saga = sagaRepository.load(sagaId);
if (parameterResolverFactory != null) {
((AbstractAnnotatedSaga) saga).registerParameterResolverFactory(parameterResolverFactory);
}
processedSagas.put(sagaId, saga);
}
}
for (Saga saga : processedSagas.values()) {
if (sagaType.isInstance(saga) && saga.isActive()
&& containsAny(saga.getAssociationValues(), entry.getAssociationValues())) {
try {
ensureActiveUnitOfWork();
saga.handle(entry.getPublishedEvent());
} catch (Exception e) {
logger.error("Saga threw an exception while handling an Event. Ignoring and moving on...", e);
}
sagaInvoked = true;
}