微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

通过 Java API 进行 Oracle BPM 故障恢复

如何解决通过 Java API 进行 Oracle BPM 故障恢复

有谁用过java API来恢复Oracle BPM故障? 我正在使用以下代码来恢复代码运行成功的 BPM 故障,但没有对实例故障进行任何更改,甚至故障修改日期也没有更改,这与使用 em 在故障本身上单击重试按钮不同。

package oracle.bpm.example;

import java.util.Hashtable;

import java.util.List;

import javax.naming.Context;

import oracle.soa.management.facade.Fault;
import oracle.soa.management.facade.FaultRecoveryActionTypeConstants;
import oracle.soa.management.facade.Locator;
import oracle.soa.management.facade.LocatorFactory;
import oracle.soa.management.facade.bpmn.BPMNServiceEngine;
import oracle.soa.management.util.FaultFilter;

/**
 * Note: the classes in oracle.soa.management.facade.bpmn and subpackages are
 * not part of the public API and are provided as part of an as-is example 
 * for use in solving data issues in the current release.  This example 
 * is provided only to illustrate an approach for batch recover of instances
 * and should be modified to meet environment specific requirments and 
 * thoroughly tested,including removal of userid and passwords.
 */
public class BatchFaultRecovery {


    public BatchFaultRecovery() {
    }

    public static void main(String[] args) {
        Locator locator = getLocator("t3://mydev:7001/soa-infra","username","password");
        doRecovery(locator,"FaultHandlingExample","Client","ServiceTask");
    }
    
    public static void doRecovery(Locator locator,String compositeName,String componentName,String activityName) {
        try {
            BPMNServiceEngine svcEngine = (BPMNServiceEngine)locator.getServiceEngine(Locator.SE_BPMN);
            FaultFilter faultFilter = new FaultFilter();
            faultFilter.setCompositeName(compositeName);
            faultFilter.setComponentName(componentName);
            recoverFaults(svcEngine,faultFilter,activityName);
        } catch (Exception e) {
          e.printstacktrace();
        }               
    }

    public static Locator getLocator(String url,String user,String password) {
        try {
            Hashtable jndiProps = new Hashtable();
            jndiProps.put(Context.PROVIDER_URL,url);
            jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
            jndiProps.put(Context.Security_PRINCIPAL,user);
            jndiProps.put(Context.Security_CREDENTIALS,password);
            jndiProps.put("dedicated.connection","true");
            return LocatorFactory.createLocator(jndiProps);
        } catch(Exception e) {
            e.printstacktrace();
            throw new RuntimeException("Error getting Locator",e);
        }
     }

    public static void recoverFaults(BPMNServiceEngine svcEngine,FaultFilter faultFilter,String activityName) {
        System.out.println("Get Recoverable Faults");
        try {
            faultFilter.setRecoverable(true);
            //Get faults using defined filter
            List<Fault> recoverableFaults = svcEngine.getFaults(faultFilter);
            for (Fault fault : recoverableFaults) {
           System.out.println(">>>>>>>>>");
           System.out.println("Composite         :"+fault.getCompositedn().getCompositeName());
           System.out.println("Composite Instance:"+fault.getCompositeInstanceId());
           System.out.println("Component         :"+fault.getComponentName());
           System.out.println("Component Instance:"+fault.getComponentInstanceId());
           System.out.println("Reference         :"+fault.getReferenceName());
           System.out.println("Service           :"+fault.getServiceName());
           System.out.println("Label             :"+fault.getLabel());
           System.out.println("Fault Id          :"+fault.getId());
           System.out.println("Fault Name        :"+fault.getName());
           System.out.println("isRecoverable     :"+fault.isRecoverable());
           System.out.println("Message           :"+fault.getMessage());

            
           //Retry  fault
           System.out.println("Start recovery ...");
           svcEngine.recoverFault(fault,FaultRecoveryActionTypeConstants.ACTION_RETRY,null);
           System.out.println("Finish recovery");
           System.out.println("<<<<<<<<<");
     
         }
       } catch (Exception e) {
         e.printstacktrace();
       }
     }
}

有人可以帮我追踪或找到解决方案吗?

解决方法

使用以下方法解决了这个问题,它工作正常并且实例恢复了:

bpmnServiceEngine.recoverCallbackMessages(BPMCallbackMessage);

但我仍然需要知道 bpmnServiceEngine.recoverCallbackMessages(BPMCallbackMessage) 之间的区别 和 bpmnServiceEngine.recoverFault(Fault) !!.

,

我在文档中没有看到: https://docs.oracle.com/middleware/1213/soasuite/api-reference-soa/toc.htm

查看“bpmnServiceEngine”类的文档。通过 [Ctrl + 单击] 在相同的类名上。并分析这两种方法或将它们粘贴到此处。另外请不要添加感叹号,我们在这里合作并不要求。最好的。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。