activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dr.jeff" <jlans...@systechnologies.com>
Subject Re: [camel] using camel spring container
Date Thu, 03 May 2007 15:47:42 GMT

Very good, excellent even, and nearly working. This:

  <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
    <endpoint id="endpoint1" uri="direct:start"/>
    <endpoint id="endpoint2" uri="mock:end"/>
    <route>
      <from ref="endpoint1"/>
      <choice>
        <when>
          <predicate>
            <header name="destination"/>
            <isEqualTo value="firstChoice"/>
          </predicate>
          <to ref="endpoint2"/>
        </when>
        <otherwise>
          <to ref="endpoint2"/>
        </otherwise>
      </choice>
    </route>
  </camelContext>

gives this:

Exception in thread "main"
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected
exception parsing XML document from class path resource
[endpointReference.xml]; nested exception is
org.apache.camel.spring.xml.IllegalActionException: Illegal route.The action
'to' cannot be used as the starting action.
Caused by: org.apache.camel.spring.xml.IllegalActionException: Illegal
route.The action 'to' cannot be used as the starting action.
	at
org.apache.camel.spring.xml.CamelBeanDefinitionParser.parseAction(CamelBeanDefinitionParser.java:161)
	at
org.apache.camel.spring.xml.CamelBeanDefinitionParser.parseBuilderElement(CamelBeanDefinitionParser.java:87)
	at
org.apache.camel.spring.xml.CamelBeanDefinitionParser.parseBuilderElement(CamelBeanDefinitionParser.java:92)
	at
org.apache.camel.spring.xml.CamelBeanDefinitionParser.parseBuilderElement(CamelBeanDefinitionParser.java:92)
	at
org.apache.camel.spring.xml.CamelBeanDefinitionParser.parseInternal(CamelBeanDefinitionParser.java:65)
	at
org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:56)
	at
org.apache.camel.spring.xml.CamelNamespaceHandler$1.doParse(CamelNamespaceHandler.java:50)
	at
org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:70)
	at
org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:56)
	at
org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
	at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1114)
	at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1104)
	at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:133)
	at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90)
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:458)
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:353)
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
	at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
	at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
	at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:173)
	at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:112)
	at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79)
	at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:100)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:298)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
...



James.Strachan wrote:
> 
> On 5/3/07, dr.jeff <jlansing@systechnologies.com> wrote:
>>
>>
>>   <camelContext id="camel"
>> xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
>>     <endpoint id="endpoint1" uri="mock:endpoint1"/>
>>     <routes>
>>     </routes>
>>   </camelContext>
>>
>> This looks good, but how do I use it?
>>
>> I've tried things like:
>>
>> <from uri="endpoint1"/> and <from uri="#endpoint1"/> and <from
>> endpoint="endpoint1"/> and <from endpoint="#endpoint1/>, but all of them
>> fail, mostly for different reasons (eg. #endpoint1 is not an NMTOKEN).
>>
>> Surely it's obvious, but I'm missing it?
> 
> Ah I'd not done that bit yet :) I'd done it so that you can refer to
> Endpoint instances as bean references inside a spring <property
> name="foo" ref="someName"/>.
> 
> I've just implemented this so that now the <from> and <to> can be used
> with the references
> 
> <from uri="theURI"/> or <from ref="theReference"/>
> 
> I've added a test case to show it in action...
> 
> http://svn.apache.org/repos/asf/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/endpointReference.xml
> 
> Along the way I also removed the unnecesary <routes> element, so a
> context can look like
> 
> <camelContext>
>   <endpoint ... />
>   <endpoint ... />
> 
>   <route ... />
>   <route ... />
> </camelContext>
> 
> So you'll wanna so an 'svn up' of all of camel and try the new xsd etc.
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/-camel--using-camel-spring-container-tf3663875s2354.html#a10306522
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message