/** * Initialize a configuration for a Saga of given {@code sagaType}, using a Subscribing Event Processor to process * incoming Events. * * @param sagaType The type of Saga to handle events with * @param <S> The type of Saga configured in this configuration * @return a SagaConfiguration instance, ready for further configuration */ public static <S> SagaConfiguration<S> subscribingSagaManager(Class<S> sagaType) { return subscribingSagaManager(sagaType, Configuration::eventBus); }
/** * Initialize a configuration for a Saga of given {@code sagaType}, using a Subscribing Event Processor to process * incoming Events from the message source provided by given {@code messageSourceBuilder} * * @param sagaType The type of Saga to handle events with * @param messageSourceBuilder The function providing the message source based on the configuration * @param <S> The type of Saga configured in this configuration * @return a SagaConfiguration instance, ready for further configuration */ public static <S> SagaConfiguration<S> subscribingSagaManager( Class<S> sagaType, Function<Configuration, SubscribableMessageSource<EventMessage<?>>> messageSourceBuilder) { return subscribingSagaManager(sagaType, messageSourceBuilder, c -> DirectEventProcessingStrategy.INSTANCE); }
/** * Initialize a configuration for a Saga of given {@code sagaType}, using a Subscribing Event Processor (with * provided name) to process incoming Events. * * @param sagaType The type of Saga to handle events with * @param processingGroup The name of the processing group to be used for this saga * @param <S> The type of Saga configured in this configuration * @return a SagaConfiguration instance, ready for further configuration */ public static <S> SagaConfiguration<S> subscribingSagaManager(Class<S> sagaType, String processingGroup) { return subscribingSagaManager(sagaType, processingGroup, Configuration::eventBus, c -> DirectEventProcessingStrategy.INSTANCE); }
.registerModule(queryModelConfiguration) .registerModule(commandPublisherConfiguration) .registerModule(SagaConfiguration.subscribingSagaManager(SellTradeManagerSaga.class)) .registerModule(SagaConfiguration.subscribingSagaManager(BuyTradeManagerSaga.class)) .buildConfiguration(); configuration.start();