You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by kennystone <ke...@yahoo.com> on 2008/04/23 04:23:30 UTC
Message Router
Hello all,
I'm fairly new to activemq and camel. I am trying to get the simple example
working with the message router. I changed the output queue to TEST.FOOT and
am trying to route to it.
Question 1: Why does my routing logic produce an error?
This works fine:
<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<route>
<from uri="activemq:TEST.FOO"/>
<to uri="activemq:TEST.FOOT"/>
</route>
</camelContext>
But when I try to put in routing logic, I get an error.
<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring">
<route>
<from uri="activemq:TEST.FOO"/>
<choice>
<when>
<predicate>
<header name="foo"/>
<isEqualTo value="bar"/>
</predicate>
<to uri="activemq:TEST.FOOT"/>
</when>
</choice>
</route>
</camelContext>
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
org.apache.camel.RuntimeCam
elException: java.lang.NullPointerException
java.lang.RuntimeException: Failed to execute start task. Reason:
org.apache.camel.RuntimeCamelExcep
tion: java.lang.NullPointerException (full error at the end)
Question 2:
I'm using activemq-cpp. How do I actually get the header name and value
pair from the routing logic (foo/bar) into my message? Is it
setStringProperty?
Thanks,
Kenny
Full error from the routing logic:
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
org.apache.camel.RuntimeCam
elException: java.lang.NullPointerException
java.lang.RuntimeException: Failed to execute start task. Reason:
org.apache.camel.RuntimeCamelExcep
tion: java.lang.NullPointerException
at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:99)
at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
at
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:104)
at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
at
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.activemq.console.Main.runTaskClass(Main.java:222)
at org.apache.activemq.console.Main.main(Main.java:106)
Caused by: org.apache.camel.RuntimeCamelException:
java.lang.NullPointerException
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:98)
at
org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicati
onEventMulticaster.java:77)
at
org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(Simple
ApplicationEventMulticaster.java:75)
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractAppli
cationContext.java:246)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicatio
nContext.java:355)
at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicati
onContext.java:64)
at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicati
onContext.java:52)
at
org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.
java:91)
at
org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:51)
at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
at
org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:112)
at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)
... 10 more
Caused by: java.lang.NullPointerException
at
org.apache.camel.model.ExpressionNode.createFilterProcessor(ExpressionNode.java:96)
at org.apache.camel.model.WhenType.createProcessor(WhenType.java:49)
at
org.apache.camel.model.ChoiceType.createProcessor(ChoiceType.java:61)
at
org.apache.camel.model.ProcessorType.makeProcessor(ProcessorType.java:882)
at
org.apache.camel.model.ProcessorType.addRoutes(ProcessorType.java:87)
at org.apache.camel.model.RouteType.addRoutes(RouteType.java:182)
at org.apache.camel.model.RouteType.addRoutes(RouteType.java:80)
at org.apache.camel.model.RouteType.addRoutes(RouteType.java:71)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:
449)
at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:441)
at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:140)
at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:51)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:96)
... 23 more
ERROR: java.lang.Exception: org.apache.camel.RuntimeCamelException:
java.lang.NullPointerException
java.lang.Exception: org.apache.camel.RuntimeCamelException:
java.lang.NullPointerException
at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:100)
at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
at
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:104)
at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
at
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.activemq.console.Main.runTaskClass(Main.java:222)
at org.apache.activemq.console.Main.main(Main.java:106)
Caused by: org.apache.camel.RuntimeCamelException:
java.lang.NullPointerException
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:98)
at
org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicati
onEventMulticaster.java:77)
at
org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(Simple
ApplicationEventMulticaster.java:75)
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractAppli
cationContext.java:246)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicatio
nContext.java:355)
at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicati
onContext.java:64)
at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicati
onContext.java:52)
at
org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.
java:91)
at
org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:51)
at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
at
org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:112)
at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)
... 10 more
Caused by: java.lang.NullPointerException
at
org.apache.camel.model.ExpressionNode.createFilterProcessor(ExpressionNode.java:96)
at org.apache.camel.model.WhenType.createProcessor(WhenType.java:49)
at
org.apache.camel.model.ChoiceType.createProcessor(ChoiceType.java:61)
at
org.apache.camel.model.ProcessorType.makeProcessor(ProcessorType.java:882)
at
org.apache.camel.model.ProcessorType.addRoutes(ProcessorType.java:87)
at org.apache.camel.model.RouteType.addRoutes(RouteType.java:182)
at org.apache.camel.model.RouteType.addRoutes(RouteType.java:80)
at org.apache.camel.model.RouteType.addRoutes(RouteType.java:71)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:
449)
at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:441)
at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:140)
at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:51)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:96)
... 23 more
--
View this message in context: http://www.nabble.com/Message-Router-tp16829656s2354p16829656.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.