SagaConfiguration Axon4

Planing to upgrade for Axon 4.1 , stuck in upgrading the below snipped equivalent in Axon 4

@Bean
public SagaConfiguration orderProcessingSagaSagaConfiguration() {
return SagaConfiguration.subscribingSagaManager(OrderProcessingSaga.class, c -> inboundEventMessageChannelAdapter());
}

@Bean
public InboundEventMessageChannelAdapter inboundEventMessageChannelAdapter() {
InboundEventMessageChannelAdapter inboundEventMessageChannelAdapter = new InboundEventMessageChannelAdapter();
sinkChannel.messageChannel().subscribe(inboundEventMessageChannelAdapter);
return inboundEventMessageChannelAdapter;
}

@Bean
public EmbeddedEventStore eventStore(EventStorageEngine storageEngine, AxonConfiguration configuration) {
return EmbeddedEventStore.builder()
.storageEngine(storageEngine)
.messageMonitor(configuration.messageMonitor(EventStore.class, “eventStore”))
.build();
}

@Bean
public EventStorageEngine storageEngine(MongoClient client) {
return MongoEventStorageEngine.builder().mongoTemplate(DefaultMongoTemplate.builder().mongoDatabase(client).build()).build();
}

@Autowired
private org.axonframework.mongo.eventhandling.saga.repository.MongoTemplate sagaMongoTemplate;

@Bean
public SagaStore mongoSagaStore() {
return MongoSagaStore.builder().mongoTemplate(DefaultMongoTemplate.builder().mongoDatabase(mongoClient).build())
.build();
}

Bold code is not working for me , You help will be deeply appreciated . Store saga in mongo , I am using mongdb-extension and axon-kafka extension

/Saranga

Hi,

in Axon 4, all configuration of Event Handling (whether it is Sagas or “regular” event handlers) is done using the EventProcessingConfigurer class.
So in your Configuration class, you should do something like:
@Autowired

public void configureEventHandling(EventProcessingConfigurer config) {
// for the Saga to use your Mongo Store
config.registerSaga(OrderProcessingSaga.class, sagaConf -> sagaConf.registerSagaStore(c -> mongoSagaStore()));

// for the Saga to be assigned to a SubscribingProcessor
config.registerSubscribingProcessor(“OrderProcessingSagaProcessor”, c -> inboundEventMessageChannelAdapter() );
}

Or alternatively, on your Saga, specify the name of the Saga store (in your case “mongoSagaStore”) in the @Saga annotation. You can also specify an @ProcessingGroup annotation on your Saga to assign it to a specific processor name. The default is [Simple Saga Class Name]Processor.

Hope this helps.
Cheers,