camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Anstey <jans...@gmail.com>
Subject Re: Problem with Dynamic Recipient list and XPath
Date Thu, 02 Oct 2008 18:59:53 GMT
Hi Suresh,

You'll need to use Camel 1.5-SNAPSHOT to use a constant expression (see 
http://activemq.apache.org/camel/constant.html).

You can get nightly SNAPSHOTs here
http://people.apache.org/maven-snapshot-repository/org/apache/camel/apache-camel/1.5-SNAPSHOT/

Suresh Inavolu wrote:
> Hi,
>
> Thanks for information Claus.
>
> A queue with that name is present - I am able to run the other patterns with the queue
name.
>
> Also I am unable to use the tag <constant>. 
> It is not recognizing this tag correctly. Problem with schema http://activemq.apache.org/camel/schema/spring/camel-spring.xsd?
In the schema I don't find any element named "constant".
>
> When I try to run it, it giving an SAX Parser exception,
>
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 5 in XML
document from URL [file:/C:/Documents%20and%20Settings/sinavolu/runtime-New_configuration/RoutingSlip/sample_input-camel.xml]
is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid
content was found starting with element 'constant'. One of '{"http://activemq.apache.org/camel/schema/spring":description,
"http://activemq.apache.org/camel/schema/spring":el, "http://activemq.apache.org/camel/schema/spring":groovy,
"http://activemq.apache.org/camel/schema/spring":header, "http://activemq.apache.org/camel/schema/spring":jxpath,
"http://activemq.apache.org/camel/schema/spring":javaScript, "http://activemq.apache.org/camel/schema/spring":expression,
"http://activemq.apache.org/camel/schema/spring":methodCall, "http://activemq.apache.org/camel/schema/spring":ognl,
"http://activemq.apache.org/camel/schema/spring":php, "http://activemq.apache.org/camel/schema/spring":python,
"http://activemq.apache.org/camel/schema/spring":ruby, "http://activemq.apache.org/camel/schema/spring":simple,
"http://activemq.apache.org/camel/schema/spring":sql, "http://activemq.apache.org/camel/schema/spring":xpath,
"http://activemq.apache.org/camel/schema/spring":xquery}' is expected.
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
> 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
>
> Thanks
> Suresh
>
> -----Original Message-----
> From: Claus Ibsen [mailto:ci@silverbullet.dk] 
> Sent: Thursday, October 02, 2008 12:36 PM
> To: camel-user@activemq.apache.org
> Subject: RE: Problem with Dynamic Recipient list and XPath
>
> Hi
>
> And if you use:
>
>     <from uri="jms:topic:SampleT1" id="Camel_JMS_2"/>
>
>     <recipientList>
>
>         <constant>jms:queue:SampleQ1</constant>
>
>     </recipientList>
>
>
> Just to be sure that the jms queue can be found?
>
> It looks like that the xpath is evaluated to a string "[#text: jms:queue:SampleQ1]" where
it contains the [#text: ] stuff as it shouldn't. 
>
> BTW: What version of camel are you using?
>
> About the tokenizer: Maybe the Spring DSL has a missing feature there as well as you
build your expression. And there is no default tonkenize. It's only used if you add it to
your expression. In the sample it's used for a single header value, such as a String that
is split using the tokenizer.
>
> In you case you use a xpath expression that does not need the tokenizer. It will still
create something that can be iterated for the recipenetlist.
>
>
>
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: Suresh Inavolu [mailto:sinavolu@progress.com] 
> Sent: 2. oktober 2008 17:05
> To: camel-user@activemq.apache.org
> Subject: Problem with Dynamic Recipient list and XPath
>
> Hi, 
>
>  
>
> I am working on the dynamic recipient list, and have some problems :-(
> with it.
>
>  
>
> The dynamic recipient list is throwing some exceptions while running -
> here are the details
>
>  
>
> For this pattern (I am using Spring XML configuration instead of Java
> DSL):
>
>  
>
> <route xmlns="http://activemq.apache.org/camel/schema/spring">
>
>     <from uri="jms:topic:SampleT1" id="Camel_JMS_2"/>
>
>     <recipientList>
>
>         <xpath>/root/addr/text()</xpath>
>
>     </recipientList>
>
> </route>
>
>  
>
> It is supposed to send the message to all the recipients listed in the
> xpath /root/addr
>
>  
>
> So if this message is sent to the topic SampleT1,
>
> <root>
>
>             <addr>jms:queue:SampleQ1</addr>
>
>             <addr>jms:queue:SampleQ2</addr>
>
>             <moreDetails>...</moreDetails>
>
> </root>
>
>  
>
> It should forward the same message to both SampleQ1 and SampleQ2. Is
> this right?
>
>  
>
> But when I run it, it is giving the following exception: Even if I don't
> use the text() function (just use the XPath /root/addr) it is giving an
> error
>
>  
>
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.NoSuchEndpointException: No endpoint could be found
> for: [#text: jms:queue:SampleQ1]
>
>       at
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(Endpoin
> tMessageListener.java:71)
>
>       at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvo
> keListener(AbstractMessageListenerContainer.java:531)
>
>       at
> org.springframework.jms.listener.AbstractMessageListenerContainer.invoke
> Listener(AbstractMessageListenerContainer.java:466)
>
>       at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExec
> uteListener(AbstractMessageListenerContainer.java:435)
>
>       at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer
> .doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:322)
>
>       at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer
> .receiveAndExecute(AbstractPollingMessageListenerContainer.java:260)
>
>       at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMe
> ssageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java
> :944)
>
>       at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMe
> ssageListenerInvoker.run(DefaultMessageListenerContainer.java:875)
>
>       at java.lang.Thread.run(Thread.java:595)
>
> Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could
> be found for: [#text: jms:queue:SampleQ1]
>
>       at
> org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelConte
> xtHelper.java:54)
>
>       at
> org.apache.camel.util.ExchangeHelper.resolveEndpoint(ExchangeHelper.java
> :85)
>
>       at
> org.apache.camel.processor.RecipientList.resolveEndpoint(RecipientList.j
> ava:74)
>
>       at
> org.apache.camel.processor.RecipientList.process(RecipientList.java:65)
>
>       at
> org.apache.camel.management.InstrumentationProcessor.process(Instrumenta
> tionProcessor.java:69)
>
>       at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.j
> ava:155)
>
>       at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.j
> ava:91)
>
>       at
> org.apache.camel.management.InstrumentationProcessor.process(Instrumenta
> tionProcessor.java:57)
>
>       at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcess
> or.java:39)
>
>       at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.
> java:41)
>
>       at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncP
> rocessor.java:66)
>
>       at
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(Endpoin
> tMessageListener.java:68)
>
>       ... 8 more
>
>  
>
>  
>
> Also what is equivalent spring configuration for this DSL:
>
>  
>
> from("direct:a").recipientList(
>         header("recipientListHeader").tokenize(","));
>
>  
>
> I can use a header expression but not the tokenizer,
>
>  
>
> <route xmlns="http://activemq.apache.org/camel/schema/spring">
>
>     <from uri="jms:topic:SampleT1" id="Camel_JMS_2"/>
>
>     <recipientList>
>
>         <header>$foo</header>
>
>     </recipientList>
>
> </route>
>
>  
>
> So what does the above pattern do? Get the list of all recipient list
> from the header - but what is the default tokenize value?
>
>  
>
> Thanks
>
> Suresh
>
>  
>
>   



Mime
View raw message