Hi,

I'm new to both Camel and EIP so maybe my question/problem is dumb ;).

I have a route defined in Spring as this :
    
    <!-- ActiveMQ beans and usual stuff -->

    <bean id="uploadBean"
class="be.ucm.career.quarterly.upload.UploadBean"/>
    
    <camel:camelContext xmlns="http://camel.apache.org/schema/spring";>
        <camel:package>foo.bar</camel:package>
        <camel:route>
            <camel:from uri="file:src/data?noop=true&amp;delay=30000" />
            <camel:bean ref="uploadBean"/>
            <camel:to uri="jms:output" />
        </camel:route>
    </camel:camelContext>

The implementation of "uploadBean" :

public class UploadBean {

        @Handler
        public String upload(@XPath("configuration/loopCount/text()")String
chunkSize) {
                
                System.out.println("Chunk size is : " + chunkSize);
                return "FOO_123";
        }
}

When launching the project with "mvn camel:run", I get this :

[...]
// INFO output
[...]
Chunk size is : 100
[src/data?delay=30000&noop=true] BrokerService                  INFO 
Using Persistence Adapter: AMQPersistenceAdapter(activemq-data\localhost)
[src/data?delay=30000&noop=true] AMQPersistenceAdapter          INFO 
AMQStore starting using directory: activemq-data\localhost
[src/data?delay=30000&noop=true] KahaStore                      INFO  Kaha
Store using data directory activemq-data\localhost\kr-store\state
[src/data?delay=30000&noop=true] AMQPersistenceAdapter          INFO 
Active data files: [1]
[src/data?delay=30000&noop=true] BrokerService                  INFO 
ActiveMQ 5.2.0 JMS Message Broker (localhost) is starting
[src/data?delay=30000&noop=true] BrokerService                  INFO  For
help or more information please see: http://activemq.apache.org/
[                 JMX connector] ManagementContext              INFO  JMX
consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
[src/data?delay=30000&noop=true] KahaStore                      INFO  Kaha
Store using data directory activemq-data\localhost\kr-store\data
[src/data?delay=30000&noop=true] BrokerService                  INFO 
ActiveMQ JMS Message Broker (localhost,
ID:100WCTI150-2821-1278413932666-0:0) started
[src/data?delay=30000&noop=true] TransportConnector             INFO 
Connector vm://localhost Started
[src/data?delay=30000&noop=true] TransportConnector             INFO 
Connector vm://localhost Stopped
[src/data?delay=30000&noop=true] BrokerService                  INFO 
ActiveMQ Message Broker (localhost, ID:100WCTI150-2821-1278413932666-0:0)
is shutting down
[src/data?delay=30000&noop=true] BrokerService                  INFO 
ActiveMQ JMS Message Broker (localhost,
ID:100WCTI150-2821-1278413932666-0:0) stopped
[Fatal Error] output.txt:1:1: Content is not allowed in prolog.
[Fatal Error] :1:1: Content is not allowed in prolog.
[src/data?delay=30000&noop=true] DefaultErrorHandler            ERROR
Failed delivery for exchangeId: b109fe1a-964e-4c70-91b0-bba46fb77766.
Exhausted after delivery attempt: 1 caught:
org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath:
configuration/loopCount/text(). Reason:
javax.xml.xpath.XPathExpressionException
org.apache.camel.builder.xml.InvalidXPathExpression: Invalid xpath:
configuration/loopCount/text(). Reason:
javax.xml.xpath.XPathExpressionException
[...]
// STACK TRACE
[src/data?delay=30000&noop=true] GenericFileOnCompletion        WARN 
Rollback file strategy:
org.apache.camel.component.file.strategy.genericfilenoopprocessstrat...@b9237a
for file: GenericFile[output.txt]

I'm wondering why I get this message, since the XPath is correct : you can
see the output of the method called on the bean at the beginning the
aforementioned snippet.
Moreover, I don't know where did the file component get this "output.txt"
file... :-/

The input.xml file is quite simple :

<?xml version="1.0"?>
<configuration>
    <loopCount>100</loopCount>
</configuration>

Can someone tell me what I'm doing wrong ?

Regards.
-- 
Bruno Dusausoy
YP5 Software
--
Pensez environnement : limitez l'impression de ce mail.
Please don't print this e-mail unless you really need to.

Reply via email to