1
votes

I am trying to write a simple camel example. I just want to read from file and send its content to a queue. This is how my camelContext declaration looks like:

<camel:camelContext>

    <camel:route id="FileToQueue">
        <camel:from uri="file:src/data/?delay=1000" />
        <camel:to uri="activemq:queue:foo" />
    </camel:route>

</camel:camelContext>

Unfortunately this doesn't work. Nothing is written into the queue. Reading from filesystem works as expected, I already checked that. Reading from that queue also worked fine (I sent a message using the admin web interface from activemq und received that message).

The problem is that there is no exception raised or any other error shown. I must admit that I am new to camel and activemq, so there is a good chance that I missed something.

I also tried to read from one queue and send this message to another. Reading a message was a success, sending not. The message was lost after reading.

I am using camel 2.11.1 and activemq 5.8.0.

--- Update (resolved): that was the missing part in my pom.xml (exclusions):

<dependency>
   <groupId>org.apache.activemq</groupId>
   <artifactId>activemq-camel</artifactId>
   <version>5.8.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jms</artifactId>
        </exclusion>
    </exclusions>
</dependency>

I appreciate your thoughts. Best regards, Daniel

1
Are you sure you are putting file to correct directory? When you create route from "file:src/data/?delay=1000" to another file with different directory. Is it working?Robert Balent
Yes, I already checked that. Reading from that directory isn't the problem.Daniel

1 Answers

0
votes

if you log the body between both uri, what do you have ? If the body null at some point. By the way, can you edit your question to show us how you define the activemq endpoint ? (broker url etc ... it may simply be an issue there)