io.github.factoryfx.copperbridge.WorkflowLauncher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of copperBridge Show documentation
Show all versions of copperBridge Show documentation
factoryfx dependency injection framework
The newest version!
package io.github.factoryfx.copperbridge;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.copperengine.core.Acknowledge;
import org.copperengine.core.CopperException;
import org.copperengine.core.Response;
import org.copperengine.core.WorkflowInstanceDescr;
import org.copperengine.core.common.AbstractProcessingEngine;
import org.copperengine.core.persistent.PersistentScottyEngine;
import org.copperengine.core.tranzient.TransientScottyEngine;
import org.copperengine.core.util.Backchannel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WorkflowLauncher {
private static final Logger logger = LoggerFactory.getLogger(WorkflowLauncher.class);
private final TransientScottyEngine transientEngine;
private final PersistentScottyEngine persistentEngine;
private final Backchannel backchannel;
public WorkflowLauncher(TransientScottyEngine transientEngine, PersistentScottyEngine persistentEngine, Backchannel backchannel) {
this.transientEngine = transientEngine;
this.persistentEngine = persistentEngine;
this.backchannel = backchannel;
}
public enum EngineType{
PERSISTENT,
TRANSIENT;
private AbstractProcessingEngine getEngine(TransientScottyEngine transientScottyEngine, PersistentScottyEngine persistentScottyEngine){
return this == PERSISTENT? persistentScottyEngine : transientScottyEngine;
}
}
public void fire(EngineType engineType, String workflowName, Object inputBean, int priority) {
try {
logger.debug("CALL -- {}({})", workflowName, inputBean);
WorkflowInstanceDescr