Mezai,
Why don't you persist the last number you processed and put in a
PropertyPlaceholder when polling again?
http://camel.apache.org/using-propertyplaceholder.html
Little example I made:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
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">
<bean id="beerFunction" class="eu.integrify.springTryOut.MyBeerFunction"/>
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<propertyPlaceholder id="properties" location="none"
ignoreMissingLocation="true">
<propertiesFunction ref="beerFunction"/>
</propertyPlaceholder>
<camel:route>
<camel:from uri="{{beer:foo}}"/>
<camel:log message="Mail polling succeeded"/>
<camel:to uri="log:test?level=debug"></camel:to>
</camel:route>
</camel:camelContext>
</beans>
public finalclass MyBeerFunction implements PropertiesFunction {
@Override
public String getName() {
return "beer";
}
@Override
public String apply(String remainder) {
return "pop3:test" ;
}
}
On 4/02/2015 5:53, Mezai 279 wrote:
Thanks a ton!! this worked for me...
I have done some thing like below:
<route streamCache=*"true"*>
<from uri=
*"imaps://{{mailScanner.imap.host}}:{{mailScanner.imap.port}}?username={{mailScanner.email}}&password={{mailScanner.email.password}}&delete=true&unseen=true&closeFolder=false&disconnect=false&consumer.delay=60000&copyTo=folder1"*
/>
<log message=*"Email Read from mailbox.
${in.header.copyTo}, ${out.header.copyTo}, ${header.copyTo},
${property.copyTo}"*/>
<process ref=*"folderNameProcesor"*/>
<log message=*"##header.copyTo = ${header.copyTo},
${property.copyTo}"*/>
</route>
My processor in the route *folderNameProcesor,*has a static variable and
every time processor is called it sets folder(n+1) in the copyTo header.
This did not work for me in the route (check header value and setting new
value based on current header value) as the header gets reset every time
inbox is polled.
-Regards
Sasi
On Tue, Feb 3, 2015 at 7:57 PM, Bart Horré <[email protected]> wrote:
If I read the docs of copyTo correctly you should be able to change to add
a header with the copyTo value at runtime.
*Camel 2.10:* Consumer only. After processing a mail message, it can be
copied to a mail folder with the given name. You can override this
configuration value, with a header with the key copyTo, allowing you to
copy messages to folder names configured at runtime.
Is that an option?
Bart Horré
Anova r&d bvba
On Tue, Feb 3, 2015 at 3:02 PM, Mezai 279 <[email protected]> wrote:
Thanks Bart Horre!
Here i want to change a particular attribute in the <from it self
<from uri="imaps://{{mailScanner.
imap.host}}:{{mailScanner.imap.port}}?username={{mailScanner.email}}&password={{mailScanner.email.password}}&delete=true&unseen=true&closeFolder=false&disconnect=false&consumer.delay=60000&copyTo=
*folder2*"/>
copyTo should be changed dynamically each time it is polling the mail
server.
I believe recipient list will not be helpful here.
-Thanks
Sasi
On Tue, Feb 3, 2015 at 7:10 PM, Bart Horré <[email protected]> wrote:
Hi,
you could use a recipient list to dynamically identify the endpoint.
http://camel.apache.org/recipient-list.html
Bart Horré
Anova r&d bvba
On Tue, Feb 3, 2015 at 10:39 AM, Mezai 279 <[email protected]>
wrote:
I m planning to write a route which will have to move messages from
inbox
to four different folders folder1, folder2, folder3, folder4 every 5
minutes. How can i do this?
<from
uri="imaps://{{mailScanner.imap.host}}:{{mailScanner.imap.port}}?username={{mailScanner.email}}&password={{mailScanner.email.password}}&delete=true&unseen=true&closeFolder=false&disconnect=false&consumer.delay=60000&copyTo=
*folder2*"/>
I need to dynamically change folder2 to folder1, folder4 every 5
miutes.
-Thanks
Sasi