0

我们可以使用故障序列处理 WSO2ESb 中的错误,它在 ESB 级别的处理只有我们如何处理 DSS 级别的错误,例如主键违规,输入参数错误。

对于 WSO2DSS 级别,我们有任何单独的故障处理程序,否则我们只能在 WSO2ESB 级别处理。

我正在 ESB 端尝试,但我无法通过故障序列处理它。

这是 DSS 级别错误,我该如何处理:

 ERROR {org.wso2.carbon.dataservices.core.description.query.SQLQuery} -  ERROR: duplicate key value violates unique constraint "emp_pkey"
  Detail: Key (eno)=(9) already exists.
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "emp_pkey"
  Detail: Key (eno)=(9) already exists.


[2013-03-12 10:45:44,914] ERROR {org.wso2.carbon.dataservices.core.DBInOnlyMessageReceiver} -  Error in in-only message receiver
DS Fault Message: Error in DS non result invoke.
DS Code: DATABASE_ERROR
Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processNormalQuery'
DS Code: DATABASE_ERROR
Source Data Service:-
Name: dept_DataService
Location: /dept_DataService.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: insert_dept_operation
Current Params: {deptid=7, deptno=, deptname=hr}
Nested Exception:-
java.lang.NumberFormatException: For input string: ""

ESb 直接向客户端发送消息。

消息是:

{"Exception":"DS Fault Message: Error in DS non result invoke.\nDS Code: DATABASE_ERROR\nNested Exception:-\njavax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processNormalQuery'\nDS Code: DATABASE_ERROR\nSource Data Service:-\nName: dept_DataService\nLocation: \/dept_DataService.dbs\nDescription: N\/A\nDefault Namespace: http:\/\/ws.wso2.org\/dataservice\nCurrent Request Name: insert_dept_operation\nCurrent Params: {deptid=7, deptno=, deptname=hr}\nNested Exception:-\njava.lang.NumberFormatException: For input string: \"\"\n\n"}
4

1 回答 1

2

So here, when an error occurs in DSS, it will send back a SOAP fault to the user, which is, in this case, the ESB. For the ESB, this is still just another message response, and it will not goto the fault sequence, unless you explicitly check the message and do the necessary actions. But from ESB 4.5.0, now you have the option of saying, if the response is a SOAP fault, the execution should switch to the fault sequence. This is explained in detail here [1].

[1] http://maharachchi.blogspot.com/2012/09/now-you-can-send-soapfaults-to-fault.html

Cheers, Anjana.

于 2013-03-13T04:40:08.350 回答