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

org.reactivecommons.async.impl.CommandExecutor Maven / Gradle / Ivy

package org.reactivecommons.async.impl;


import org.reactivecommons.api.domain.Command;
import org.reactivecommons.async.impl.communications.Message;
import org.reactivecommons.async.api.handlers.CommandHandler;
import reactor.core.publisher.Mono;

import java.util.function.Function;

public class CommandExecutor {
    private final CommandHandler eventHandler;
    private final Function> converter;

    public CommandExecutor(CommandHandler eventHandler, Function> converter) {
        this.eventHandler = eventHandler;
        this.converter = converter;
    }

    public Mono execute(Message rawMessage){
        return eventHandler.handle(converter.apply(rawMessage));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy