Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AB92D4FE2 for ; Tue, 31 May 2011 20:08:54 +0000 (UTC) Received: (qmail 69565 invoked by uid 500); 31 May 2011 20:08:54 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 69524 invoked by uid 500); 31 May 2011 20:08:54 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 69516 invoked by uid 99); 31 May 2011 20:08:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2011 20:08:54 +0000 X-ASF-Spam-Status: No, hits=1.3 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_FRT_BEFORE,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dwhytock@gmail.com designates 209.85.160.45 as permitted sender) Received: from [209.85.160.45] (HELO mail-pw0-f45.google.com) (209.85.160.45) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2011 20:08:48 +0000 Received: by pwi6 with SMTP id 6so2606066pwi.32 for ; Tue, 31 May 2011 13:08:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=V743JQCpeNlb9MHhgGmHTbuate+ujQnCky5OBqJi/MI=; b=nFnMGP0OSjnwUgzGPVMQ1YaSkvva7x5XEv3HxrkIkex+fX2QtAELwrqdMD2D4ccvgr DwSv9SMmXkY1gFYzaFu/xbLF1q63YpsZWYaGmJAJHWaAGOOpBgvkjYZygRyrz8hsizbB q1VNnX0wASe+yVx6obZ7LQZKaq45Lum2uD1z0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=e0hnHcYZoEUiqXofP4wOValWfGhTEdVRtBwsEERTEo3uQUNzWddeITztOd2MUVkHan XEYXWqjVbh1ZGhJX8OKAsyb2Y6OkWi9kpVHnANKJ7SIrh73OlyKVGi/wWJp7Av7Nor+Q dnTAi4koewAtrejJsACQd2kKs9tjUb9nHarGg= MIME-Version: 1.0 Received: by 10.68.1.170 with SMTP id 10mr2442015pbn.189.1306872506649; Tue, 31 May 2011 13:08:26 -0700 (PDT) Received: by 10.68.50.131 with HTTP; Tue, 31 May 2011 13:08:26 -0700 (PDT) In-Reply-To: References: <1485526445.5451306871678898.JavaMail.bharat@Bharat-Goyals-MacBook-Pro.local> Date: Tue, 31 May 2011 16:08:26 -0400 Message-ID: Subject: Re: date functions/URL params for http endpoint From: Donald Whytock To: users@camel.apache.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org If you're committed to writing a Processor, you can perhaps use ProducerTemplate, which lets you send an Exchange to a String URI. public class FooSearch implements Processor { ProducerTemplate producer; public FooSearch(CamelContext context) { producer =3D context.createProducerTemplate(); } public void process(Exchange exchange) { String startdate =3D ; String enddate =3D ; producer.send("http://www.foo.com/search?startdate=3D" + startdate + "&enddate=3D" + enddate, exchange); } } On Tue, May 31, 2011 at 3:57 PM, Fernando Ribeiro wrote: > Donald raised an important point, need to make sure the start date is > computed dynamically (using the Simple EL does the trick). The approach t= hat > I mentioned to you will also only work if you can restart the route every > time the number of days changes -- what is your case there? Thanks. > > On Tue, May 31, 2011 at 4:54 PM, Bharat Goyal wrote: > >> Any sample example of the spring config as well as sample java class wou= ld >> be appreciated. Am a newbie to Camel so trying to figure out my way with >> this. >> >> >> ----- Original Message ----- >> From: "Donald Whytock" >> To: users@camel.apache.org >> Sent: Tuesday, May 31, 2011 12:49:00 PM GMT -08:00 US/Canada Pacific >> Subject: Re: date functions/URL params for http endpoint >> >> toF isn't runtime-dynamic, right? =A0It's gonna take the startdate and >> enddate when the route is built and make a static endpoint? >> >> If you need the endpoint to change at runtime, you'll need to use some >> sort of placeholder in the route that you can change. >> >> Don >> >> On Tue, May 31, 2011 at 3:31 PM, Fernando Ribeiro >> wrote: >> > You only really need the route builder to be configured once, don't wo= rry >> > about it. >> > >> > On Tue, May 31, 2011 at 4:19 PM, Bharat Goyal >> wrote: >> > >> >> Thanks for your response. I assume this can be done in multiple ways. >> >> However, with the way you are suggesting, wouldnt the "configure" met= hod >> of >> >> concrete RouteBuilder class be called just once? =A0am 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") >> >> =A0.process(SomeProcessor) >> >> =A0.toF("http://www.foo.com/search?startDate=3D%s&endDate=3D%s", star= tDate, >> >> endDate); >> >> >> >> SourceURIL - would be quartz consumer >> >> >> >> I would write a hava SomeProcessor.class which would fill in startDat= e >> and >> >> endDate. >> >> >> >> Trying to figure out what a good practice is. >> >> >> >> Thanks >> >> >> >> >> >> ----- Original Message ----- >> >> From: "Fernando Ribeiro" >> >> 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 builde= r >> and >> >> initialize it in your beans.xml file: >> >> >> >> >> >> =A0 >> >> >> >> >> >> Does that work for you? >> >> >> >> Fernando >> >> >> >> On Tue, May 31, 2011 at 3:19 PM, Bharat Goyal >> 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) >> >> > >> >> > >> >> > >> >> > >> >> > >> >> >> ************************************************************************= ****************** >> >> > =93CONFIDENTIALITY NOTICE: The information transmitted in this mess= age >> 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 ha= ve >> >> > received this in error, please contact the sender and delete this >> e-mail >> >> and >> >> > associated material from any computer. The intended recipient of th= is >> >> 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.=94 >> >> > >> >> > ----- Original Message ----- >> >> > From: "Fernando Ribeiro" >> >> > To: users@camel.apache.org >> >> > Sent: Tuesday, May 31, 2011 11:18:07 AM GMT -08:00 US/Canada Pacifi= c >> >> > 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 >> >> 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 processo= r? >> Are >> >> > > there any date functions available to subtract dates for e.g? >> >> > > >> >> > > Thanks, >> >> > > Bharat >> >> > > >> >> > >> >> >> > >> >