camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bharat Goyal <bha...@adchemy.com>
Subject Re: date functions/URL params for http endpoint
Date Wed, 01 Jun 2011 00:29:29 GMT
When we defined the processor as mentioned  above:
public class MyProcessor implements Processor {
    ProducerTemplate producer;
......
    public void process(Exchange exchange)
    {
URI uri = ... (dynamic params used)
........
        producer.send(uri, exchange);
    }


in spring xml:
        <route id="http-my-route" >
          <from uri="direct:start"/>
          <to uri="myHttpProcessor"/>
          <to uri="log:newxml"/>
        </route>

When running this, we don't see anything in the log - expected xml from the specified uri="http://.....
The process method doesnt seem to get called.


******************************************************************************************

“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: "Donald Whytock" <dwhytock@gmail.com>
To: users@camel.apache.org
Sent: Tuesday, May 31, 2011 2:30:20 PM GMT -08:00 US/Canada Pacific
Subject: Re: date functions/URL params for http endpoint

You can add an ID to your route and start it and stop it using the ID.

Your route would be

from(endpoint)
  .routeID(idString)
  .process(whatever);

You can then use camelcontext.stopRoute(idString) to stop the route
and camelcontext.startRoute(idString) to re-start it.

On Tue, May 31, 2011 at 4:04 PM, Bharat Goyal <bharat@adchemy.com> wrote:
> Is there a way to stop/re-start routes without needing the web container re-start?
>
> If yes, please provide any sample config/examples that may help.
>
>
>
> ******************************************************************************************
> “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" <webmaster@fernandoribeiro.eti.br>
> To: users@camel.apache.org
> Sent: Tuesday, May 31, 2011 12:57:47 PM GMT -08:00 US/Canada Pacific
> Subject: Re: date functions/URL params for http endpoint
>
> Donald raised an important point, need to make sure the start date is
> computed dynamically (using the Simple EL does the trick). The approach that
> 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 <bharat@adchemy.com> wrote:
>
>> Any sample example of the spring config as well as sample java class would
>> be appreciated. Am a newbie to Camel so trying to figure out my way with
>> this.
>>
>>
>> ----- Original Message -----
>> From: "Donald Whytock" <dwhytock@gmail.com>
>> 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?  It'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
>> <webmaster@fernandoribeiro.eti.br> wrote:
>> > You only really need the route builder to be configured once, don't worry
>> > about it.
>> >
>> > On Tue, May 31, 2011 at 4:19 PM, Bharat Goyal <bharat@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" <webmaster@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 <bharat@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" <webmaster@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 <bharat@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
>> >> > >
>> >> >
>> >>
>> >
>>
>

Mime
View raw message