You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ad86 <di...@fh-brandenburg.de> on 2011/01/21 12:28:16 UTC

Use a route only once

Hello,

I have a project in which I get two rss-files. I split them and I need to
add some more information to every splitted messages. This information I
need only once and after that the specific route should be closed. For
example:

//get rss-file
from("rss:http://earthquake.usgs.gov/eqcenter/catalogs/eqs1day-M2.5.xml?throttleEntries=false&consumer.userFixedDelay=true").marshal().rss().convertBodyTo(String.class).process(new
Processor(){
	public void process(Exchange arg0) throws Exception {
		// doe soemthing
		getWeather();
	}
}).to("direct:earths");

// get weather information
public static void getWeather() throws Exception{
	context.addRoutes(new RouteBuilder() {
		public void configure() {
		
from("http://api.wxbug.net/getLiveWeatherRSS.aspx?ACode=xxxxxxxxx&lat=12&long=52&unittype=1&OutputType=1").process(new
Processor(){
				public void process(Exchange arg0) throws Exception {
					// do something
				}
			}).to("direct:earths");
		}
	});
}

The route in getWeather will be performed, when a new splitted rss-feed
comes in. And I will only need the weather once. The problem at the moment
is, that I get the weather information often. So does anyone have an idea,
what to to?

Thanks

ad86
-- 
View this message in context: http://camel.465427.n5.nabble.com/Use-a-route-only-once-tp3351204p3351204.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Use a route only once

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

Can you take a look at SimpleScheduledRoutePolicy
http://camel.apache.org/simplescheduledroutepolicy.html
http://camel.apache.org/simplescheduledroutepolicy.html 

It can do the job for you.

Cheers,

Ashwin...


-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com
http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
-- 
View this message in context: http://camel.465427.n5.nabble.com/Use-a-route-only-once-tp3351204p3351217.html
Sent from the Camel - Users mailing list archive at Nabble.com.