You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Yari Marchetti <ya...@dada.net> on 2010/03/20 14:13:36 UTC

Problem with Http component and redeliveryPolicy

Hi everyone,
i configured Camel with a route like:

<route>
    <from uri="activemq:test.queue"/>

    <onException>
        <exception>java.net.ConnectException</exception>
        <redeliveryPolicy maximumRedeliveries="10" 
                                  backOffMultiplier="2" 
                                  delay="1000" 
                                  maximumRedeliveryDelay="60000" 
                                  useExponentialBackOff="true" />    
     </onException>
    <setHeader headerName="CamelHttpMethod">
        <constant>GET</constant>
    </setHeader>
    <to uri="http://localhost:81" />
</route>

but i found 2 problems:

1) the exponential backoff and delay seems to not be working correctly 
With the above configuration i see 10 retries done in a timespan of 10ms or
so. am i doing something wrong?

2) i need to set the query string for the http component but i can't find how.
Reading the documentation i can find some examples using DSL, but i need
to do it with Spring XML. is it possible? and would it be difficult to transform every
message header to a query string parameter?

Reading the documentation and the ML i was not able to find a solution. Maybe 
here someone does know the answers.

Regards,
Yari

R: Problem with Http component and redeliveryPolicy

Posted by Yari Marchetti <ya...@dada.net>.
worked perfectly, thanks :)
________________________________________
Da: Claus Ibsen [claus.ibsen@gmail.com]
Inviato: domenica 21 marzo 2010 14.14
A: users@camel.apache.org
Oggetto: Re: Problem with Http component and redeliveryPolicy

Hi

You XML is invalid.

The delay attribute is called redeliveryDelay, eg something like this:

                <redeliveryPolicy maximumRedeliveries="4"
redeliveryDelay="100" maximumRedeliveryDelay="5000"
                                  backOffMultiplier="2"
useExponentialBackOff="true"/>

See this unit test just committed
http://svn.apache.org/viewvc?rev=925764&view=rev




On Sat, Mar 20, 2010 at 2:13 PM, Yari Marchetti <ya...@dada.net> wrote:
> Hi everyone,
> i configured Camel with a route like:
>
> <route>
>    <from uri="activemq:test.queue"/>
>
>    <onException>
>        <exception>java.net.ConnectException</exception>
>        <redeliveryPolicy maximumRedeliveries="10"
>                                  backOffMultiplier="2"
>                                  delay="1000"
>                                  maximumRedeliveryDelay="60000"
>                                  useExponentialBackOff="true" />
>     </onException>
>    <setHeader headerName="CamelHttpMethod">
>        <constant>GET</constant>
>    </setHeader>
>    <to uri="http://localhost:81" />
> </route>
>
> but i found 2 problems:
>
> 1) the exponential backoff and delay seems to not be working correctly
> With the above configuration i see 10 retries done in a timespan of 10ms or
> so. am i doing something wrong?
>
> 2) i need to set the query string for the http component but i can't find how.
> Reading the documentation i can find some examples using DSL, but i need
> to do it with Spring XML. is it possible? and would it be difficult to transform every
> message header to a query string parameter?
>
> Reading the documentation and the ML i was not able to find a solution. Maybe
> here someone does know the answers.
>
> Regards,
> Yari



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Problem with Http component and redeliveryPolicy

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You XML is invalid.

The delay attribute is called redeliveryDelay, eg something like this:

                <redeliveryPolicy maximumRedeliveries="4"
redeliveryDelay="100" maximumRedeliveryDelay="5000"
                                  backOffMultiplier="2"
useExponentialBackOff="true"/>

See this unit test just committed
http://svn.apache.org/viewvc?rev=925764&view=rev




On Sat, Mar 20, 2010 at 2:13 PM, Yari Marchetti <ya...@dada.net> wrote:
> Hi everyone,
> i configured Camel with a route like:
>
> <route>
>    <from uri="activemq:test.queue"/>
>
>    <onException>
>        <exception>java.net.ConnectException</exception>
>        <redeliveryPolicy maximumRedeliveries="10"
>                                  backOffMultiplier="2"
>                                  delay="1000"
>                                  maximumRedeliveryDelay="60000"
>                                  useExponentialBackOff="true" />
>     </onException>
>    <setHeader headerName="CamelHttpMethod">
>        <constant>GET</constant>
>    </setHeader>
>    <to uri="http://localhost:81" />
> </route>
>
> but i found 2 problems:
>
> 1) the exponential backoff and delay seems to not be working correctly
> With the above configuration i see 10 retries done in a timespan of 10ms or
> so. am i doing something wrong?
>
> 2) i need to set the query string for the http component but i can't find how.
> Reading the documentation i can find some examples using DSL, but i need
> to do it with Spring XML. is it possible? and would it be difficult to transform every
> message header to a query string parameter?
>
> Reading the documentation and the ML i was not able to find a solution. Maybe
> here someone does know the answers.
>
> Regards,
> Yari



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

R: Problem with Http component and redeliveryPolicy

Posted by Yari Marchetti <ya...@dada.net>.
yes i'm sorry, completely forgot about it. I'm using version 2.2.0
________________________________________
Da: Claus Ibsen [claus.ibsen@gmail.com]
Inviato: sabato 20 marzo 2010 15.03
A: users@camel.apache.org
Oggetto: Re: Problem with Http component and redeliveryPolicy

Hi

Remember to state the versions you are using. See this wiki page please
http://camel.apache.org/support.html


On Sat, Mar 20, 2010 at 2:13 PM, Yari Marchetti <ya...@dada.net> wrote:
> Hi everyone,
> i configured Camel with a route like:
>
> <route>
>    <from uri="activemq:test.queue"/>
>
>    <onException>
>        <exception>java.net.ConnectException</exception>
>        <redeliveryPolicy maximumRedeliveries="10"
>                                  backOffMultiplier="2"
>                                  delay="1000"
>                                  maximumRedeliveryDelay="60000"
>                                  useExponentialBackOff="true" />
>     </onException>
>    <setHeader headerName="CamelHttpMethod">
>        <constant>GET</constant>
>    </setHeader>
>    <to uri="http://localhost:81" />
> </route>
>
> but i found 2 problems:
>
> 1) the exponential backoff and delay seems to not be working correctly
> With the above configuration i see 10 retries done in a timespan of 10ms or
> so. am i doing something wrong?
>
> 2) i need to set the query string for the http component but i can't find how.
> Reading the documentation i can find some examples using DSL, but i need
> to do it with Spring XML. is it possible? and would it be difficult to transform every
> message header to a query string parameter?
>
> Reading the documentation and the ML i was not able to find a solution. Maybe
> here someone does know the answers.
>
> Regards,
> Yari



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Problem with Http component and redeliveryPolicy

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Remember to state the versions you are using. See this wiki page please
http://camel.apache.org/support.html


On Sat, Mar 20, 2010 at 2:13 PM, Yari Marchetti <ya...@dada.net> wrote:
> Hi everyone,
> i configured Camel with a route like:
>
> <route>
>    <from uri="activemq:test.queue"/>
>
>    <onException>
>        <exception>java.net.ConnectException</exception>
>        <redeliveryPolicy maximumRedeliveries="10"
>                                  backOffMultiplier="2"
>                                  delay="1000"
>                                  maximumRedeliveryDelay="60000"
>                                  useExponentialBackOff="true" />
>     </onException>
>    <setHeader headerName="CamelHttpMethod">
>        <constant>GET</constant>
>    </setHeader>
>    <to uri="http://localhost:81" />
> </route>
>
> but i found 2 problems:
>
> 1) the exponential backoff and delay seems to not be working correctly
> With the above configuration i see 10 retries done in a timespan of 10ms or
> so. am i doing something wrong?
>
> 2) i need to set the query string for the http component but i can't find how.
> Reading the documentation i can find some examples using DSL, but i need
> to do it with Spring XML. is it possible? and would it be difficult to transform every
> message header to a query string parameter?
>
> Reading the documentation and the ML i was not able to find a solution. Maybe
> here someone does know the answers.
>
> Regards,
> Yari



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Problem with Http component and redeliveryPolicy

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Mar 20, 2010 at 2:13 PM, Yari Marchetti <ya...@dada.net> wrote:
> Hi everyone,
> i configured Camel with a route like:
>
> <route>
>    <from uri="activemq:test.queue"/>
>
>    <onException>
>        <exception>java.net.ConnectException</exception>
>        <redeliveryPolicy maximumRedeliveries="10"
>                                  backOffMultiplier="2"
>                                  delay="1000"
>                                  maximumRedeliveryDelay="60000"
>                                  useExponentialBackOff="true" />
>     </onException>
>    <setHeader headerName="CamelHttpMethod">
>        <constant>GET</constant>
>    </setHeader>
>    <to uri="http://localhost:81" />
> </route>
>
> but i found 2 problems:
>
> 1) the exponential backoff and delay seems to not be working correctly
> With the above configuration i see 10 retries done in a timespan of 10ms or
> so. am i doing something wrong?
>
> 2) i need to set the query string for the http component but i can't find how.
> Reading the documentation i can find some examples using DSL, but i need
> to do it with Spring XML. is it possible? and would it be difficult to transform every
> message header to a query string parameter?
>

See the Exchange as it has many constant keys.
I recon you need this key: CamelHttpQuery

For example:
exchange.getIn().setHeader(Exchange.HTTP_QUERY, "hl=en&q=camel");

<setHeader headerName="CamelHttpQuery">
    <constant>h1=en&g=camel</constant>
</setHeader>

Instead of the <constant> you can use a <methodCall> to invoke a POJO
where you return the query string as you like.



> Reading the documentation and the ML i was not able to find a solution. Maybe
> here someone does know the answers.
>
> Regards,
> Yari



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus