/** * Returns the {@link SagaConfiguration} for the given {@code sagaType}. If no configuration has been provided for * a Saga of this type, {@code null} is returned. * * @param sagaType the type of Saga to return the configuration for. * @param <T> the type of Saga * @return the configuration for the Saga, or {@code null} if not found */ @SuppressWarnings("unchecked") default <T> SagaConfiguration<T> sagaConfiguration(Class<T> sagaType) { return (SagaConfiguration<T>) sagaConfigurations().stream().filter(c -> sagaType.equals(c.type())).findFirst().orElse(null); }
private void registerSagaManagers(Map<String, List<Function<Configuration, EventHandlerInvoker>>> handlerInvokers) { sagaConfigurations.forEach(sc -> { SagaConfiguration<?> sagaConfig = sc.initialize(configuration); String processingGroup = selectProcessingGroupByType(sagaConfig.type()); String processorName = processorNameForProcessingGroup(processingGroup); handlerInvokers.computeIfAbsent(processorName, k -> new ArrayList<>()) .add(c -> sagaConfig.manager()); }); }
/** * Returns the {@link SagaConfiguration} for the given {@code sagaType}. If no configuration has been provided for * a Saga of this type, {@code null} is returned. * * @param sagaType the type of Saga to return the configuration for. * @param <T> the type of Saga * @return the configuration for the Saga, or {@code null} if not found */ @SuppressWarnings("unchecked") default <T> SagaConfiguration<T> sagaConfiguration(Class<T> sagaType) { return (SagaConfiguration<T>) sagaConfigurations().stream().filter(c -> sagaType.equals(c.type())).findFirst().orElse(null); }
private void registerSagaManagers(Map<String, List<Function<Configuration, EventHandlerInvoker>>> handlerInvokers) { sagaConfigurations.forEach(sc -> { SagaConfiguration<?> sagaConfig = sc.initialize(configuration); String processingGroup = selectProcessingGroupByType(sagaConfig.type()); String processorName = processorNameForProcessingGroup(processingGroup); handlerInvokers.computeIfAbsent(processorName, k -> new ArrayList<>()) .add(c -> sagaConfig.manager()); }); }