You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sandp <sa...@gmail.com> on 2014/10/01 19:44:32 UTC

camel-jms 2.14.0 option validation on startup from an expression

Hi,
Camel is trying to validate the option value *for correct Type *against the
value of an expression on start up. For *timeToLive* option, the JMS
endpoint fails the validation and blows up with an Exception since, the
value for option timeToLive is dynamically driven on some logic and it would
never get it on startup. Is there a way to tell Camel to ignore such
validation on endpoint? OR What is the best way to get around it?

*ROUTE:*
.to("jms:queue:ctsCamelQueue?timeToLive=*${in.headers.messageTimeToLive}*&forceSendOriginalMessage=true")


*Exception*
*Caused by: org.apache.camel.TypeConversionException:* Error during type
conversion from type: java.lang.String to the required type: long with value
${in.headers.messageTimeToLive} due java.lang.NumberFormatException: For
input string: "${in.headers.messageTimeToLive}"
	at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:566)




--
View this message in context: http://camel.465427.n5.nabble.com/camel-jms-2-14-0-option-validation-on-startup-from-an-expression-tp5757289.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-jms 2.14.0 option validation on startup from an expression

Posted by sandp <sa...@gmail.com>.
I was able to get over the issue by setting disableReplyTo=true on the
producer endpoint.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-jms-2-14-0-option-validation-on-startup-from-an-expression-tp5757289p5758344.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-jms 2.14.0 option validation on startup from an expression

Posted by sandp <sa...@gmail.com>.
Hi,
I'm using the recipientList to pass *timetoLive *option dynamically. The
issue I'm facing is that the consumer does send a replyTo, if I use a
recipientList . If I use a static URL, it sends back a replyTo the queue.
How do I get around this?

*The route below does not  produce a replyTo*
=====Producer==========
from("direct:ctsJMSProducerRoute").id("c
tsJMSProducerRoute")

.recipientList(simple("jms:queue:ctsCamelQueue?replyTo=ctsReplyQueue&replyToType=Shared&concurrentConsumers=10&requestTimeout=50000&timeToLive=${in.headers."+JMSConstants.TIME_TO_LIVE+"}")).setExchangePattern(ExchangePattern.InOnly)
.end();


*The route below produces a replyTo without recipientList*
===== Producer==========
from("direct:ctsJMSProducerRoute").id("ctsJMSProducerRoute")

.to(ExchangePattern.InOnly,"jms:queue:ctsCamelQueue?replyTo=ctsReplyQueue&replyToType=Shared&concurrentConsumers=10&requestTimeout=50000&timetoLive
=30000")
.end();


=====Consumer========
from("jms:queue:ctsCamelQueue?replyTo=ctsReplyQueue&replyToType=Shared&transacted=false&requestTimeout=60000").setExchangePattern(ExchangePattern.InOut)



--
View this message in context: http://camel.465427.n5.nabble.com/camel-jms-2-14-0-option-validation-on-startup-from-an-expression-tp5757289p5758317.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-jms 2.14.0 option validation on startup from an expression

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

See this FAQ
http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html

On Wed, Oct 1, 2014 at 7:44 PM, sandp <sa...@gmail.com> wrote:
> Hi,
> Camel is trying to validate the option value *for correct Type *against the
> value of an expression on start up. For *timeToLive* option, the JMS
> endpoint fails the validation and blows up with an Exception since, the
> value for option timeToLive is dynamically driven on some logic and it would
> never get it on startup. Is there a way to tell Camel to ignore such
> validation on endpoint? OR What is the best way to get around it?
>
> *ROUTE:*
> .to("jms:queue:ctsCamelQueue?timeToLive=*${in.headers.messageTimeToLive}*&forceSendOriginalMessage=true")
>
>
> *Exception*
> *Caused by: org.apache.camel.TypeConversionException:* Error during type
> conversion from type: java.lang.String to the required type: long with value
> ${in.headers.messageTimeToLive} due java.lang.NumberFormatException: For
> input string: "${in.headers.messageTimeToLive}"
>         at
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:566)
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-jms-2-14-0-option-validation-on-startup-from-an-expression-tp5757289.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/