Bramha Naidu,

There is no directory property on the FilePoller, but you can specify a directory instead of a file on the file property.

Does the file you are polling contain XML? If not, you should specify another marshaler (e.g. org.apache.servicemix.components.util.SimpleFlatFileMarshaler) on both the poller and sender endpoint. Otherwise, you will get parser exceptions when the sender is trying to parse the message while writing it to disk. Doesn't your console show exceptions?

Gert


Hi Gert,

I am using the class org.apache.servicemix.components.file.FilePoller for polling for a particular file. This class does not allow me to use a directory property. So when I use file property to locate the file, it is working fine.

<sm:activationSpec componentName="filePoller" service="pollfile:filePoller" destinationService="pollfile:fileSender">

<sm:component>

<bean class="org.apache.servicemix.components.file.FilePoller">

<property name="file" value="D:/FileFolder/Testfile.txt"/>

<property name="period" value="5000"/>

<property name="deleteFile" value="false"/>

<property name="filter">

<ref bean="filter"/>

</property>

</bean>

</sm:component>

</sm:activationSpec>

But the problem is with the file sender component. I am using org.apache.servicemix.components.file.FileWriter to write the file to a location. But I am getting a file with 0kb at the destination folder.

Please help.

The sender component is written as below:

<sm:activationSpec componentName="fileSender" service="pollfile:fileSender">

<sm:component>

<bean class="org.apache.servicemix.components.file.FileWriter">

<property name="directory" value="D:/dest" />

<property name="marshaler">

<bean class="org.apache.servicemix.components.util.DefaultFileMarshaler">

<!--<property name="useMessageContent" value="false"/>-->

<property name="fileName">

<bean class="org.apache.servicemix.expression.JaxenStringXPathExpression">

<constructor-arg value="concat('sample_', /sample/@id, '.txt')" />

</bean>

</property>

</bean>

</property>

</bean>

</sm:component>

</sm:activationSpec>

Thanks&Regards

Brahma Naidu

-----Original Message-----
From: Gert Vanthienen [mailto:[EMAIL PROTECTED]
Sent: Monday, June 11, 2007 2:46 PM
To: [email protected]
Cc: Aelem, Bramha Naidu (Cognizant)
Subject: Re: Reg:servicemix-lw container

L.S.,

Continuing this on the users mailing list...

First of all, I would recommend you to use the new JBI component

(servicemix-file) for polling and sending files. Look at

http://incubator.apache.org/servicemix/servicemix-file.html for more

information on that one.

For the lightweight example you have here:

- You should make the file attribute in the poller refer to a directory

instead of a file.

- If you want to transfer something other than XML files, you should be

using a Marshaler to do so (e.g. ServiceMix's SimpleFlatFileMarshaler or

one you build yourself)

Regards,

Gert

[EMAIL PROTECTED] wrote:

>

> Hi Gert,

>

> Could you please help me in servicemix-lwcontainer?

>

> I am copying file from source to destination using filepoller and

> filesender components. But it’s copying file from source with zero

> bytes. How to resolve this error.

>

> My servicemix.xml looks like this:

>

> <beans xmlns:sm="http://servicemix.apache.org/config/1.0";

>

> xmlns:pollfile="http://pollfile.cts.com/pollFile";>

>

> <classpath>

>

> <location>.</location>

>

> <location>lib/servicemix-components-3.1-incubating.jar</location>

>

> <location>lib/oro-2.0.8.jar</location>

>

> </classpath>

>

> <sm:serviceunit id="jbi">

>

> <sm:activationSpecs>

>

> *<!-- Look for files in the source directory -->*

>

> * *

>

> <sm:activationSpec componentName="filePoller"

> service="pollfile:filePoller" destinationService="pollfile:fileSender">

>

> <sm:component>

>

> <bean class="org.apache.servicemix.components.file.FilePoller">

>

> <property name="file" value="D:/MySQLTest/mysqltest.txt" />

>

> <property name="period" value="5000" />

>

> <property name="deleteFile" value="false" />

>

> <property name="filter" ref="rfilter" />

>

> </bean>

>

> </sm:component>

>

> </sm:activationSpec>

>

> *<!-- Write files to the destination directory -->*

>

> * *

>

> <sm:activationSpec componentName="fileSender"

> service="pollfile:fileSender">

>

> <sm:component>

>

> <bean class="org.apache.servicemix.components.file.FileWriter">

>

> <property name="directory" value="D:/dest/" />

>

> <property name="marshaler">

>

> <bean class="org.apache.servicemix.components.util.DefaultFileMarshaler">

>

> * <!--*

>

> *<property name="fileName">*

>

> * <bean class="org.apache.servicemix.jbi.JaxenStringXPathExpression">*

>

> * <constructor-arg value="concat('sample_', /sample/@id, '.txt')" />*

>

> * </bean>*

>

> * </property>*

>

> * *--* >*

>

> </bean>

>

> </property>

>

> </bean>

>

> </sm:component>

>

> </sm:activationSpec>

>

> </sm:activationSpecs>

>

> </sm:serviceunit>

>

> <bean id="rfilter" class="org.apache.oro.io.GlobFilenameFilter">

>

> <constructor-arg value="*.txt"/>

>

> </bean>

>

> </beans>

>

> I commented some portion in the destination part with that it’s

> copying file from source to destination with 0 bytes.

>

> Could you please help me in this problem?

>

> How to copy exact file form source directory to destination directory?

>

> *Thanks&Regards*

>

> *Bramha Naidu Aelem*

>

> This e-mail and any files transmitted with it are for the sole use of

> the intended recipient(s) and may contain confidential and privileged

> information.

> If you are not the intended recipient, please contact the sender by

> reply e-mail and destroy all copies of the original message.

> Any unauthorized review, use, disclosure, dissemination, forwarding,

> printing or copying of this email or any action taken in reliance on

> this e-mail is strictly

> prohibited and may be unlawful.

>

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly
prohibited and may be unlawful.


Reply via email to