當前位置: 首頁>>代碼示例>>Java>>正文


Java KieSession.halt方法代碼示例

本文整理匯總了Java中org.kie.api.runtime.KieSession.halt方法的典型用法代碼示例。如果您正苦於以下問題:Java KieSession.halt方法的具體用法?Java KieSession.halt怎麽用?Java KieSession.halt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.kie.api.runtime.KieSession的用法示例。


在下文中一共展示了KieSession.halt方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testCallService

import org.kie.api.runtime.KieSession; //導入方法依賴的package包/類
@Test
public void testCallService() throws Exception {
    final Holder holder = new Holder();
    serviceDomain.registerService(new QName("CallService"), new InOnlyService(), new BaseHandler(){
        public void handleMessage(Exchange exchange) throws HandlerException {
            holder.setValue("message handled");
        }
    });
    serviceDomain.registerServiceReference(new QName("CallService"), new InOnlyService());
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add(ResourceFactory.newClassPathResource(CALL_SERVICE_BPMN), ResourceType.BPMN2);
    KieBase kbase = kbuilder.newKnowledgeBase();
    KieSession ksession = kbase.newKieSession();
    SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
    ssth.setProcessRuntime(ksession);
    ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain));
    ksession.getWorkItemManager().registerWorkItemHandler(SWITCHYARD_SERVICE_TASK, ssth);
    ksession.startProcess("CallService");
    ksession.halt();
    ksession.dispose();
    Assert.assertEquals("message handled", holder.getValue());
}
 
開發者ID:jboss-switchyard,項目名稱:switchyard,代碼行數:23,代碼來源:BPMServiceTests.java

示例2: runFaultBoundaryProcess

import org.kie.api.runtime.KieSession; //導入方法依賴的package包/類
private void runFaultBoundaryProcess(final boolean bomb) throws Exception {
    serviceDomain.registerService(new QName("TestService"), new InOnlyService(), new BaseHandler(){
        public void handleMessage(Exchange exchange) throws HandlerException {
            if (bomb) {
                throw new HandlerException("BOOM!");
            }
        }
    });
    serviceDomain.registerServiceReference(new QName("TestService"), new InOutService());
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add(ResourceFactory.newClassPathResource(FAULT_BOUNDARY_PROCESS_BPMN), ResourceType.BPMN2);
    KieBase kbase = kbuilder.newKnowledgeBase();
    KieSession ksession = kbase.newKieSession();
    SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
    ssth.setProcessRuntime(ksession);
    ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain));
    ksession.getWorkItemManager().registerWorkItemHandler(SWITCHYARD_SERVICE_TASK, ssth);
    WorkflowProcessInstance wpi = (WorkflowProcessInstance)ksession.startProcess("FaultBoundaryProcess");
    String output = (String)wpi.getVariable("TestOutput");
    Assert.assertEquals(bomb ? "Failure" : "Success", output);
    ksession.halt();
    ksession.dispose();
}
 
開發者ID:jboss-switchyard,項目名稱:switchyard,代碼行數:24,代碼來源:BPMServiceTests.java

示例3: runFaultResultProcess

import org.kie.api.runtime.KieSession; //導入方法依賴的package包/類
private void runFaultResultProcess(final boolean bomb) throws Exception {
    serviceDomain.registerService(new QName("TestService"), new InOnlyService(), new BaseHandler(){
        public void handleMessage(Exchange exchange) throws HandlerException {
            if (bomb) {
                throw new HandlerException("BOOM!");
            }
        }
    });
    serviceDomain.registerServiceReference(new QName("TestService"), new InOutService());
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add(ResourceFactory.newClassPathResource(FAULT_RESULT_PROCESS_BPMN), ResourceType.BPMN2);
    KieBase kbase = kbuilder.newKnowledgeBase();
    KieSession ksession = kbase.newKieSession();
    SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
    ssth.setProcessRuntime(ksession);
    ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain));
    ksession.getWorkItemManager().registerWorkItemHandler(SWITCHYARD_SERVICE_TASK, ssth);
    WorkflowProcessInstance wpi = (WorkflowProcessInstance)ksession.startProcess("FaultResultProcess");
    HandlerException he = (HandlerException)wpi.getVariable("faultResult");
    if (bomb) {
        Assert.assertNotNull(he);
        Assert.assertEquals("BOOM!", he.getMessage());
    } else {
        Assert.assertNull(he);
    }
    ksession.halt();
    ksession.dispose();
}
 
開發者ID:jboss-switchyard,項目名稱:switchyard,代碼行數:29,代碼來源:BPMServiceTests.java

示例4: runFaultEventProcess

import org.kie.api.runtime.KieSession; //導入方法依賴的package包/類
private void runFaultEventProcess(final boolean bomb) throws Exception {
    serviceDomain.registerService(new QName("TestService"), new InOnlyService(), new BaseHandler(){
        public void handleMessage(Exchange exchange) throws HandlerException {
            if (bomb) {
                throw new HandlerException("BOOM!");
            }
        }
    });
    serviceDomain.registerServiceReference(new QName("TestService"), new InOutService());
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add(ResourceFactory.newClassPathResource(FAULT_EVENT_PROCESS_BPMN), ResourceType.BPMN2);
    KieBase kbase = kbuilder.newKnowledgeBase();
    KieSession ksession = kbase.newKieSession();
    SwitchYardServiceTaskHandler ssth = new SwitchYardServiceTaskHandler();
    ssth.setProcessRuntime(ksession);
    ssth.setInvoker(new SwitchYardServiceInvoker(serviceDomain));
    ksession.getWorkItemManager().registerWorkItemHandler(SWITCHYARD_SERVICE_TASK, ssth);
    WorkflowProcessInstance wpi = (WorkflowProcessInstance)ksession.startProcess("FaultEventProcess");
    HandlerException he = (HandlerException)wpi.getVariable("faultEvent");
    if (bomb) {
        Assert.assertNotNull(he);
        Assert.assertEquals("BOOM!", he.getMessage());
    } else {
        Assert.assertNull(he);
    }
    ksession.halt();
    ksession.dispose();
}
 
開發者ID:jboss-switchyard,項目名稱:switchyard,代碼行數:29,代碼來源:BPMServiceTests.java


注:本文中的org.kie.api.runtime.KieSession.halt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。