-1

I'm dealing with a problem how to read a file with Camel in SMX 4.4.2 but only in case when the read operation cannot be performed in Camel route from. I need to read data from the file transform it into XML and then return it to the requestor (the requestor hits SMX via REST Service). I'm having serious problems with reading the file after the REST invokation.

Routes are like these:

<jaxrs:server id="restService" address="http://localhost:9000/REST/"
                    staticSubresourceResolution="true">
                    <jaxrs:serviceBeans>
                            <ref bean="restFtpBean" />
                    </jaxrs:serviceBeans>
</jaxrs:server>

<bean id="restFtpBean" class="poc.rest.RESTFtpProxyService" />


<cxf:rsServer id="rsServer" address="http://localhost:9000/REST/"
        serviceClass="poc.rest.RESTFtpProxyService" />


<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<endpoint id="ftpProvider" uri="ftp://localhost:21/?fileName=test.xml" />
        <route>
                <from uri="cxfrs://bean://rsServer" />               
                <to ref="ftpProvider" />
        </route>
</camel:camelContext>

In this scenario Camel tries to write to file ! What am I doing wrong ?

рüффп
  • 5,172
  • 34
  • 67
  • 113
Wojtek Rudziński
  • 689
  • 1
  • 5
  • 8

1 Answers1

0

Its always advised to learn and get familiar with the EIPs http://camel.apache.org/content-enricher.html

Your use-case you need to consume a file from within a route, and there is an EIP pattern for that: http://camel.apache.org/content-enricher.html. See the section about using pollEnrich to consume/poll the file.

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65