I thought the performance model took the two branches and processed in parallel in java. Now, given that it is not, I would like to know that I can do in java to execute in parallel my two subflows.
package com.epmbog.esb.drools.mediator;
import java.util.HashMap;
import java.util.Map;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseConfiguration;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.conf.MultithreadEvaluationOption;
import org.drools.io.ResourceFactory;
import org.drools.runtime.StatefulKnowledgeSession;
import com.epmbog.drools.utils.Constantes;
import com.epmbog.esb.drools.workitems.EJBGenericWorkItemHandler;
public class TestProcess {
public static final void main(String[] args) {
try {
KnowledgeBase knowledgeBase = readRule();
StatefulKnowledgeSession ksession = knowledgeBase.newStatefulKnowledgeSession();
ksession.getWorkItemManager().registerWorkItemHandler("TelnetConnection", new EJBGenericWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler( "TelnetDisonnection", new EJBGenericWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler( "TelnetSendCommands", new EJBGenericWorkItemHandler());
HashMap<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put( Constantes.SOFT_SWITCH_IP , "10.134.2.2");
paramMap.put( Constantes.SOFT_SWITCH_USER , null);
paramMap.put( Constantes.SOFT_SWITCH_PASS , null);
paramMap.put( Constantes.SOFT_SWITCH_PORT , "6000");
paramMap.put( Constantes.UMG_IP , "10.134.2.11");
paramMap.put( Constantes.UMG_USER , "gestor");
paramMap.put( Constantes.UMG_PASS , "gestor");
paramMap.put( Constantes.UMG_PORT , "23");
Map<String, Object> parameters = new HashMap<String, Object>();
Map<String, Object> results = new HashMap<String, Object>();
Map<String, Object> mapaFormadoPorEsbSegunDatosInfraestructuraSolicitados = new HashMap<String, Object>();
mapaFormadoPorEsbSegunDatosInfraestructuraSolicitados.put("softswitch_user", "mediator");
mapaFormadoPorEsbSegunDatosInfraestructuraSolicitados.put("softswitch_pass", "mediator");
mapaFormadoPorEsbSegunDatosInfraestructuraSolicitados.put("softswitch_number", "6057000");
mapaFormadoPorEsbSegunDatosInfraestructuraSolicitados.put("softswitch_circuitInit", "864");
mapaFormadoPorEsbSegunDatosInfraestructuraSolicitados.put("softswitch_circuitEnd", "895");
mapaFormadoPorEsbSegunDatosInfraestructuraSolicitados.put("umg_port", "00");
mapaFormadoPorEsbSegunDatosInfraestructuraSolicitados.put("umg_slot", "03");
mapaFormadoPorEsbSegunDatosInfraestructuraSolicitados.put("umg_frame", "1");
mapaFormadoPorEsbSegunDatosInfraestructuraSolicitados.put("umg_cardType", "CUALQUIERJODA");
paramMap.put( Constantes.FM_PARAMETERS_MAP , mapaFormadoPorEsbSegunDatosInfraestructuraSolicitados);
parameters.put("factsMap", paramMap);
parameters.put("resultsMap", results);
ksession.startProcess( "com.epmbog.esb.drools.mediator.PriDigitalTest", parameters );
ksession.fireAllRules();
System.out.println("Cualquier cosa");
} catch ( Throwable t ) {
t.printStackTrace();
}
}
private static KnowledgeBase readRule() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newClassPathResource( "/com/epmbog/esb/drools/mediator/PriDigitalTest.rf", TestProcess.class ),
ResourceType.DRF );
kbuilder.add( ResourceFactory.newClassPathResource( "/com/epmbog/esb/drools/mediator/SoftSwitchFlow.rf", TestProcess.class ),
ResourceType.DRF );
kbuilder.add( ResourceFactory.newClassPathResource( "/com/epmbog/esb/drools/mediator/UMGFlow.rf", TestProcess.class ),
ResourceType.DRF );
KnowledgeBaseConfiguration configuration = KnowledgeBaseFactory
.newKnowledgeBaseConfiguration();
configuration.setOption( MultithreadEvaluationOption.YES );
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(configuration);
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
return kbase;
}
}
Thank you,