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

org.reactivecommons.async.commons.EventExecutor Maven / Gradle / Ivy

package org.reactivecommons.async.commons;


import org.reactivecommons.api.domain.DomainEvent;
import org.reactivecommons.async.api.handlers.EventHandler;
import org.reactivecommons.async.commons.communications.Message;
import reactor.core.publisher.Mono;

import java.util.function.Function;

public class EventExecutor {
    private final EventHandler eventHandler;
    private final Function> converter;

    public EventExecutor(EventHandler 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