Hi See this FAQ about dynamic To in Camel http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
You need to use the recipient list EIP pattern. And for computing the URI, you can use a plain Java bean for that. Sometimes that easier. Especially if you need to calculate -30 days from today. On Tue, May 31, 2011 at 9:19 PM, Bharat Goyal <bha...@adchemy.com> wrote: > Thanks for your response. I assume this can be done in multiple ways. > However, with the way you are suggesting, wouldnt the "configure" method of > concrete RouteBuilder class be called just once? am new to Camel, so any > examples of spring config as well as the java class method would be helpful. > > > Another possible way I was thinking was: > > from("SourceURI") > .process(SomeProcessor) > .toF("http://www.foo.com/search?startDate=%s&endDate=%s", startDate, > endDate); > > SourceURIL - would be quartz consumer > > I would write a hava SomeProcessor.class which would fill in startDate and > endDate. > > Trying to figure out what a good practice is. > > Thanks > > > ----- Original Message ----- > From: "Fernando Ribeiro" <webmas...@fernandoribeiro.eti.br> > To: users@camel.apache.org > Sent: Tuesday, May 31, 2011 11:25:23 AM GMT -08:00 US/Canada Pacific > Subject: Re: date functions/URL params for http endpoint > > Bharat, > > You can create a property (with get/set) methods in your route builder and > initialize it in your beans.xml file: > > <bean id="sampleroute" class="sampleroute.SampleRouteBuilder"> > <property name="numberOfDays" value="30" /> > </bean> > > Does that work for you? > > Fernando > > On Tue, May 31, 2011 at 3:19 PM, Bharat Goyal <bha...@adchemy.com> wrote: > >> Yes, startDate is the current date and I can use ${date:now:dd/MMM/yyyy} >> >> For end date, it will be for e.g. start date - 30 days (but 30 will be read >> from a property file) >> >> >> >> >> ****************************************************************************************** >> “CONFIDENTIALITY NOTICE: The information transmitted in this message and >> its attachments (if any) is intended only for the person or entity to whom >> or which it is addressed and may contain confidential and/or privileged >> material. Any review, retransmission, dissemination or other use of, or >> taking of any action in reliance upon this information, by persons or >> entities other than the intended recipient is prohibited. If you have >> received this in error, please contact the sender and delete this e-mail and >> associated material from any computer. The intended recipient of this e-mail >> may only use, reproduce, disclose, or distribute the information contained >> in this e-mail and any attached files with the permission of the sender.” >> >> ----- Original Message ----- >> From: "Fernando Ribeiro" <webmas...@fernandoribeiro.eti.br> >> To: users@camel.apache.org >> Sent: Tuesday, May 31, 2011 11:18:07 AM GMT -08:00 US/Canada Pacific >> Subject: Re: date functions/URL params for http endpoint >> >> You mean you need to be able to get the current date (for startDate) and a >> date in a configuration (endDate) in your route, right? >> >> On Tue, May 31, 2011 at 3:13 PM, Bharat Goyal <bha...@adchemy.com> wrote: >> >> > Hello, >> > We have the requirement to pull data from a http URL on specific dates of >> > the month. >> > >> > Requirements: >> > 1. There are 2 URL params in the http call, startDate and endDate that >> > takes date expr in dd/MMM/YYYY (e.g. 05/JAN/2011) and are used to fetch >> data >> > between those 2 dates. >> > 2. Our camel-cron/quartz setup will need to run on specific dates, and >> then >> > route to the http endpoint that can retrieve this data. >> > 3. the startDate has to be the current date (whenever the quartz job >> ran), >> > but the endDate needs to be startDate - {some configured value}. How do >> we >> > do this via spring/camel config without writing a custom processor? Are >> > there any date functions available to subtract dates for e.g? >> > >> > Thanks, >> > Bharat >> > >> > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/