Disable command and event processors using Spring Boot?

What is the recommended way to selectively disable all command and event processing in a spring boot environment?

I’d like to create a background worker that processes long-running tasks (see db-scheduler, which is actually a fantastic non-Quartz scheduler). This worker should be able to send commands and queries as part of task execution, but should not handle any commands or events to preserve resources for tasks.

One strategy I have used successfully is to isolate the domain code such that there are simply no event processors to run or aggregates to service. In this particular case it is much easier to share the code with the primary domain image and assign a profile to the workers. I have a custom event storage engine bean, but the auto-configuration will happily create a replacement when my custom bean is disabled. Setting # threads to zero results in exceptions. I am hoping there is a config item such as axon.eventhandling.enabled=false and axon.commandhandling.enabled=false.

Hi Joel,
you’re probably best off using Spring Profiles for this. Simply annotate your components with @Profile("profileName"). You can then enable or disable a profile using the spring.profiles.active property. See https://docs.spring.io/spring-boot/docs/2.4.0/reference/html/spring-boot-features.html#boot-features-profiles for details.

I’d wager a more granular selection of Axon infra through Spring Boot could be helpful.
Essentially what @Jan_Galinski is asking for in this issue.

For now, enabling/disabling your components is likely the easiest way to go.