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

org.jetlinks.rule.engine.api.task.ExecutionContext Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
package org.jetlinks.rule.engine.api.task;

import org.jetlinks.rule.engine.api.Logger;
import org.jetlinks.rule.engine.api.RuleData;
import org.jetlinks.rule.engine.api.scheduler.ScheduleJob;
import reactor.core.publisher.Mono;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import java.util.function.Supplier;

public interface ExecutionContext {

    String getInstanceId();

    Logger getLogger();

    ScheduleJob getJob();

     Mono fireEvent(@Nonnull String event, @Nonnull RuleData data);

     Mono onError(@Nullable Throwable e, @Nullable RuleData sourceData);

    default  Mono onError(@NotNull Supplier e, @Nullable RuleData sourceData) {
        return Mono.defer(() -> onError(e.get(), sourceData));
    }

    Input getInput();

    Output getOutput();

    Mono shutdown(String code, String message);

    RuleData newRuleData(Object data);

    void onShutdown(Runnable runnable);

    boolean isDebug();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy