Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7676931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:18:37+00:00 2026-05-31T17:18:37+00:00

I have started playing around with Apache camel recently. So being the experimental type

  • 0

I have started playing around with Apache camel recently. So being the experimental type I thought I would create a simple project that would scan a file directory every couple of seconds to see if I have a new file pick that file up and then copy it to another folder. Later on I want to place these files into a database.

So keeping with the basics first I created a route such as the following:

 from("file://c:/CTest/inbox?noop=true")
                .to("file://C:/Ctest/outbox");

This worked and I thought ok lets add a timer. Initially I made the mistake of using a timer and trying this:

from("timer://myTimer?period=50").to("file://c:/CTest/inbox?noop=true")
                .to("file://C:/Ctest/outbox");

I then had some strange exception about not being able to write a file. I then realised by placing the file route after the timer route it became a producer. So I researched a bit and here is where I am little confused.

So from my understanding the file component uses the scheduled poll pattern. There is even a pollStrategy option in the file route url pattern. There is also a Polling Consumer EIP.

So here is where my confusion sets in.

1) If the file component uses the scheduled poll pattern does it use/implement the polling conumser EIP?

2) How do I add a simple schedule to the file component to consume files say every 30 seconds?

3) How do I create my own pollingStrategy by implementing org.apache.camel.PollingConsumerPollStrategy?

I suspect I can do something like this:

    from("file://c:/CTest/inbox?noop=true&pollStrategy=some-expression")
                .to("file://C:/Ctest/outbox");

I have tried to get some examples around this but I am either not looking at the right places or missing the plot completely. I guess this is not so much a code related question but more of a what is the best strategy/pattern for this approach.

Thanks
Namphibian

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:18:39+00:00Added an answer on May 31, 2026 at 5:18 pm

    Camel offers a feature called routepolicy
    http://camel.apache.org/routepolicy.html

    It allows you to associate policies to routes. We provide a number of policies out of the box. A policy can be any kind of logic. For example we offer a throttling policy, which on-the-fly suspend/resume routes based on threadsholds.

    Another out the box policy is a scheduled policy, so you can specify ‘opening hours’ for a route. So you can use that as well. But mind its for opening hours, so you specify a start/end time. There is a quartz cron based policy http://camel.apache.org/cronscheduledroutepolicy.html so you can configure this to start the route on monday, and let it run for a little while.

    If you need to stop a route from within a route, then thats a bit more complicated, there is a FAQ about this here: http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently started playing around with sites and created a basic page. <apex:page
I have recently started playing around with iOS development and have got most of
I recently just started playing around in PHP and got myself a small project/homework.
I have started playing around with CoreData and taking a new project with CoreData
I am playing around with MVC and have started setting up an existing site
Recently I have started playing with jQuery, and have been following a couple of
I have a basic GWT Maven project going. I added SmartGWT and started playing
I have started playing around with Berkeley DB. This one is really interesting, but
Possible Duplicate: Is JavaScript's Math broken? I have just started playing around with Javascript
I've recently started playing around with ASP.NET and I was just about to connect

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.