AEAI ESB-基于ESB的异常处理控制

1.概述

异常处理机制对于异常的捕捉,数据的回溯有非常重要的意义,AEAI ESB中提供给用户一种流程异常捕捉机制,可以使用户轻松的实现异常处理。

2.样例

2.1.异常处理主流程

2.1.1.创建Http流程

wKiom1RKBcSj8VYOAAGN8ivo9FY398.jpg

2.1.2.整体流程图

wKioL1RKBj7Q82DYAABEVF0lv-0192.jpg

     2.1.3.抛出异常组件

packagecom.aeai.video.messageflows.exceptionhandlehttp;

 

import com.agileai.esb.core.AdapteException;

importcom.agileai.esb.component.transformer.JavaTransformer;

 

public class JavaConverter1 extendsJavaTransformer{

        

         publicvoid handleRequest() throws AdapteException{

                   try{

                            thrownew Exception("抛出异常");

                   }catch (Exception e) {

                            logger.error(e.getLocalizedMessage(),e);

                            thrownew AdapteException(e.getLocalizedMessage(),e);

                   }                                  

         }

}

 2.2.异常处理子流程

 2.2.1.创建Embed流程

wKiom1RKBoixZy6xAAF6Ogwm3D0714.jpg

2.2.2.整体流程图

wKiom1RKBrahbC9VAABC6qqG0lo933.jpg

2.2.3.处理异常组件

package com.aeai.video.messageflows.exceptionhandleembed;

 

import com.agileai.esb.core.AdapteException;

import com.agileai.esb.component.transformer.JavaTransformer;

 

public class JavaConverter1 extends JavaTransformer{

        

         public voidhandleRequest() throwsAdapteException{

                   try {

                            logger.error("==出现异常啦==");

                            //处理异常

                   }catch (Exception e) {

                            logger.error(e.getLocalizedMessage(), e);

                            throw newAdapteException(e.getLocalizedMessage(),e);

                   }                                  

         }

}

2.3.调用子流程

wKioL1RKB3eQdqJ4AAGmnsquFvg875.jpgwKioL1RKB52TbKHYAAETh-mVxJs493.jpg

2.4.测试

wKioL1RKB9iR6_cfAAS4pcxZdqg437.jpg


AEAI ESB-基于ESB的异常处理控制文档   下载





你可能感兴趣的:(异常处理,ESB,流程图)