Package org.axonframework.commandhandling

Examples of org.axonframework.commandhandling.SimpleCommandBus.subscribe()


        // a CommandGateway has a much nicer API
        CommandGateway commandGateway = new DefaultCommandGateway(commandBus);

        // let's register a Command Handler that writes to System Out so we can see what happens
        commandBus.subscribe(MarkToDoItemOverdueCommand.class.getName(),
                new CommandHandler<MarkToDoItemOverdueCommand>() {
                    @Override
                    public Object handle(CommandMessage<MarkToDoItemOverdueCommand> commandMessage,
                                         UnitOfWork unitOfWork) throws Throwable {
                        System.out.println(String.format("Got command to mark [%s] overdue!",
View Full Code Here


        // we need to configure the repository
        EventSourcingRepository<ToDoItem> repository = new EventSourcingRepository<ToDoItem>(ToDoItem.class, eventStore);
        repository.setEventBus(eventBus);

        // Register the Command Handlers with the command bus by subscribing to the name of the command
        commandBus.subscribe(CreateToDoItemCommand.class.getName(),
                new CreateToDoCommandHandler(repository));
        commandBus.subscribe(MarkCompletedCommand.class.getName(),
                new MarkCompletedCommandHandler(repository));

        // We register an event listener to see which events are created
View Full Code Here

        repository.setEventBus(eventBus);

        // Register the Command Handlers with the command bus by subscribing to the name of the command
        commandBus.subscribe(CreateToDoItemCommand.class.getName(),
                new CreateToDoCommandHandler(repository));
        commandBus.subscribe(MarkCompletedCommand.class.getName(),
                new MarkCompletedCommandHandler(repository));

        // We register an event listener to see which events are created
        eventBus.subscribe(new ToDoEventListener());
View Full Code Here

            @Override
            public void add(MyAggregate aggregate) {
                throw new UnsupportedOperationException("Not implemented yet");
            }
        };
        cb.subscribe(String.class.getName(), new MyCommandHandler(repository));
//        new AnnotationCommandHandlerAdapter(new MyCommandHandler(repository), cb).subscribe();


        long COMMAND_COUNT = 5 * 1000 * 1000;
        cb.dispatch(GenericCommandMessage.asCommandMessage("ready,"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.