All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.opencredo.concourse.domain.commands.dispatching.CommandLog Maven / Gradle / Ivy

package com.opencredo.concourse.domain.commands.dispatching;

import com.opencredo.concourse.domain.commands.Command;
import com.opencredo.concourse.domain.commands.CommandResult;
import com.opencredo.concourse.domain.time.TimeUUID;

import java.util.function.Consumer;

public interface CommandLog {

    static CommandLog loggingTo(Consumer commandLogger, Consumer resultLogger) {
        return new CommandLog() {
            @Override
            public Command logCommand(Command command) {
                Command loggedCommand = command.processed(TimeUUID.timeBased());
                commandLogger.accept(loggedCommand);
                return loggedCommand;
            }

            @Override
            public void logCommandResult(CommandResult commandResult) {
                resultLogger.accept(commandResult);
            }
        };
    }

    Command logCommand(Command command);
    void logCommandResult(CommandResult commandResult);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy