HI создал простое приложение Camel Spring для использования файла XSL. Мой файл контекста верблюда показан ниже, маршрут составлен из InitProcessor, ExcelProcessor и FinalProcessor. Путь верблюда go впереди хорошо, но на конечном процессоре я вызываю веб-службу и получаю сообщение о неисправности Soap, а затем навсегда возвращает данные о доставке верблюда, почему? Он не имеет значения для объявления onException, а затем для моего пользовательского обработчика исключений (processorEx). Почему?
спасибо
верблюжий контекст. xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:annotation-config/>
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:config/conf.properties</value>
</list>
</property>
</bean>
<camelContext id="camel" trace="true" xmlns="http://camel.apache.org/schema/spring" >
<onException>
<exception>org.savino.hb.dataprovider.DataProviderException</exception>
<!--
<handled>
<constant>true</constant>
</handled>
-->
<!--log loggingLevel="ERROR" message="HEY I GOT AN EXCEPTION" /-->
<!--to uri="log:org.savino.hb.dataprovider?level=DEBUG"/-->
<to uri="processorEx"/>
<to uri="file:C:/Users/Administrator/Desktop/HB_DATA/mov_fail?fileName=${header.X_UID}"/>
<process ref="processorEx"/>
</onException>
<route>
<from uri="file:C:/Users/Administrator/Desktop/HB_DATA/mov?delay=1000&move=../mov_done&moveFailed=../mov_fail"/>
<process ref="processor"/>
<log message="Header: $simple{in.headers[X_FILENAME]}" loggingLevel="INFO" logName="header-test" />
<to uri="log:com.mycompany.order?level=DEBUG"/>
<choice>
<when>
<simple>${in.header.X_CARD} == true</simple>
<to uri="bean:excelCard"/>
</when>
<otherwise>
<to uri="bean:excelMov"/>
</otherwise>
</choice>
<to uri="bean:finalProcessor"/>
<!--process ref="processor"/-->
</route>
</camelContext>
<bean name="dataProcessor" class="org.savino.hb.dataprovider.ws.WSDataProcessor"/>
<bean name="excelMov" class="org.savino.hb.dataprovider.ExcelTransformer">
<constructor-arg index="0" value="9"/>
<constructor-arg index="1" value="1"/>
<constructor-arg index="2" value="2"/>
<constructor-arg index="3" value="3"/>
<constructor-arg index="4" value="4"/>
<constructor-arg index="5" value="5"/>
<constructor-arg index="6" value="6"/>
</bean>
<bean name="excelCard" class="org.savino.hb.dataprovider.ExcelTransformer">
<constructor-arg index="0" value="8"/>
<constructor-arg index="1" value="1"/>
<constructor-arg index="2" value="2"/>
<constructor-arg index="3" value="0"/>
<constructor-arg index="4" value="6"/>
<constructor-arg index="5" value="3"/>
<constructor-arg index="6" value="0"/>
</bean>
<bean name="processor" class="org.savino.hb.dataprovider.Processor"/>
<bean name="finalProcessor" class="org.savino.hb.dataprovider.FinalProcessor"/>
<bean name="processorEx" class="org.savino.hb.dataprovider.ProcessorEx"/>
</beans>
ProcessorEx, который я хочу выполнить, когда FinalProcessor получит исключение
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.savino.hb.dataprovider;
import org.apache.camel.Exchange;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author f.savino
*/
public class ProcessorEx implements org.apache.camel.Processor{
private static final Logger logger =LoggerFactory.getLogger(ProcessorEx.class);
@Override
public void process(Exchange exchange) throws Exception {
Exception ex = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
String uid = exchange.getIn().getHeader("X_UID").toString();
if (ex== null)
logger.warn(uid+"::Exception NULL");
else if (ex instanceof DataProviderException)
logger.error(uid+"::"+ex.toString(),ex);
else
logger.error(uid+"::Exception",ex);
}
}
FinalProcessor
public class FinalProcessor implements org.apache.camel.Processor{
@Autowired
DataProcessor dataProcessor;
@Override
public void process(Exchange exchange) throws Exception {
List<Item> m = (List<Item>) exchange.getIn().getBody();
String cc = exchange.getIn().getHeader("X_CC").toString();
String periodo = exchange.getIn().getHeader("X_PERIODO").toString();
boolean card = Boolean.valueOf(exchange.getIn().getHeader("X_CARD").toString());
DataContainer data = new DataContainer();
data.setCc(cc);
data.setCard(card);
data.setPeriodo(periodo);
data.setItems(m);
ReplyContainer reply = dataProcessor.processMov(data);
}
}