我试图让 Mule 记录我的 SOAP 组件在以下流程中引发的异常。例如,如果我将格式错误的 xml 作为输入传递,在soapUI 中我会得到一个有意义的输出,但我希望能够在控制台中记录它或将它发送到 JMS 队列。
<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
<flow name="CAB-Mule_WMBFlow1" doc:name="CAB-Mule_WMBFlow1">
<http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:8081/DemoCustomer" doc:name="HTTP" mimeType="text/xml">
<idempotent-redelivery-policy maxRedeliveryCount="3">
<dead-letter-queue>
<vm:outbound-endpoint path="error-queue" />
</dead-letter-queue>
</idempotent-redelivery-policy>
</http:inbound-endpoint>
<cxf:jaxws-service port="80" serviceClass="com.mulesoft.demo.DemoCustomer" doc:name="SOAP"/>
<component class="com.mulesoft.demo.DemoCustomerIntImpl" doc:name="Java"/>
<jms:outbound-endpoint queue="StudioIN" connector-ref="Active_MQ" doc:name="JMS"/>
<logger level="INFO" doc:name="Logger" message="Payload: #[payload]"/>
</flow>
<flow name="error" doc:name="error">
<component class="com.mulesoft.demo.ExceptionService" doc:name="Java"/>
<jms:outbound-endpoint queue="Error" connector-ref="Active_MQ" doc:name="JMS"/>
</flow>
ExceptionService 只是:
public class ExceptionService {
public void onException(ExceptionMessage e) {
System.err.println("EXCEPTION MESSAGE:::: " + e.getException().getMessage());
}
}