Axon-spring-boot-starter 3.1.1 and spring boot run a simple axon demo error. error info : ' No handler was subscribed to command '

public class Mytask {

@AggregateIdentifier
private String id;

public Mytask() {

}

@CommandHandler
public Mytask(MyTaskCreateCommand command) {
    System.out.println("step 222");
    apply(new MyTaskCreateEvent(command.getId(), command.getTitle(), command.getDescribe()));
}


@EventSourcingHandler
public  void on(MyTaskCreateEvent event) {
    this.id = event.getId();
}

private void apply(Object object){
    AggregateLifecycle.apply(object);
}

}

@RestController
public class MyTaskController {
private final IdentifierFactory identifierFactory = IdentifierFactory.getInstance();

@Autowired
private CommandGateway commandGateway;

@RequestMapping(value = "/test/anox/", method = RequestMethod.POST)
public void createMyTask(@RequestParam String title, @RequestParam String describe) {
    System.out.println("step 1111");
    commandGateway.send(new MyTaskCreateCommand(identifierFactory.generateIdentifier(), title, describe));
}

}

What is the 3.1.1 version refering to? The latest Spring Boot is at version 3.0.6 now.

This is the dependency I use in my projects.

If possible, I would advise to migrate to Axon Framework 4. Currently 4.7.4 is the latest version. I’m not sure why the handler wasn’t subscribed. Are you running it with Axon Server?

I recreated a project, but an error was reported when starting it. Can you take a look for me?
new project url : GitHub - maxianggithub/testaxon1

Thanks, I quickly updated the project and made changes to accommodate the update, like changing import. I also added a docker-compose to easily start Axon Server, and a .HTTP file to easily do the post.
I added the commit with those changes here. With that I get the expected? result:

step 1111
step 222
step 3333
aaaaa
do eventfd2b8212-89d9-478a-bb28-b53e82400533

I hope this was helpful. Please feel free to ask follow-up questions.

1 Like