DeadlineManager bean definition

Hi Everyone,
I’m trying to use Axon Framework (4.7.3) with Spring Boot. Stuck on DeadlineManager configuration. I supposed that Spring autoconfiguration will do all the job due axon-spring-boot-starter dependency. Like it did for CommandGateway, QueryGateway, etc. But I see that DeadlineManager is null and I unable to inject it.

In Axon documentation I read:

The DeadlineManager can be injected as a resource. It has three flavors: SimpleDeadlineManager , JobRunrDeadlineManager and QuartzDeadlineManager

also

Spring Boot users will need to define a DeadlineManager bean using one of the available implementations.

Could you please provide example of code DeadlineManager bean definition by SimpleDeadlineManager at least. I do not need fine tuning now. Just simplest and default configuration for proof of concepts.

I found some examples in internet but it based on deprecated AxonConfiguration.

Thanks in advance,
Andrew

We need to update the documentation, as for Jobrunr we will autoconfigure, but only if there is a JobRunr JobScheduler.

So you can go with JobRunr, and add the starter with these instructions.

You can also use the Simple one, by adding:

    @Bean
    public DeadlineManager deadlineManager(){
        return SimpleDeadlineManager.builder().build();
    }

Somewhere in an @Configuration annotated class.
From 4.8.0 we will likely also support db-scheduler.
Please let us know if you have any follow-up questions.

Gerard, thanks for assistance,
But with this Simple Bean code in @Configuration annotated class I got exception:

Error creating bean with name ‘deadlineManager’ defined in class path resource [com/example/idp/domain/configuration/DomainConfiguration.class]:
Failed to instantiate [org.axonframework.deadline.DeadlineManager]: Factory method ‘deadlineManager’ threw exception with message: The ScopeAwareProvider is a hard requirement and should be provided

Thanks, it was a bit too minimal, try this instead please:

    @Bean
    public DeadlineManager deadlineManager(
        org.axonframework.config.Configuration configuration,
        TransactionManager transactionManager,
        SpanFactory spanFactory
    ){
        ScopeAwareProvider scopeAwareProvider = new ConfigurationScopeAwareProvider(configuration);
        return SimpleDeadlineManager.builder()
                .scopeAwareProvider(scopeAwareProvider)
                .transactionManager(transactionManager)
                .spanFactory(spanFactory).build();
    }

Please note that by using the SimpleDeadlineMenager it will not persist the scheduled deadlines.