camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject Re: camel + cometd + jms
Date Wed, 17 Mar 2010 11:47:33 GMT
Hi,

I have find the solution.

My template was called like template.requestBody("activemq:stock", stock)
and not like
template.sendBody("activemq:stock", stock)

Can we said that requestBody = InOut and sendBody = InOnly for JMS ?

Kind regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Wed, Mar 17, 2010 at 11:46 AM, Charles Moulliard <cmoulliard@gmail.com>wrote:

> Hi,
>
> I have created a camel route where a timer calls every 5 seconds a bean.
> The bean is a ProducerTemplate who will generate an object and place it on
> an ActiveMq queue.
>
>     <camel:camelContext trace="true" id="gpsroute" xmlns="
> http://camel.apache.org/schema/spring">
>
>         <package>org.apache.camel.cometd</package>
>
>         <jmxAgent id="agent" createConnector="true"/>
>
>         <!--  Define a producer template -->
>         <template id="producer" />
>
>         <!-- Timer who will produce every 5 seconds a stock -->
>         <route>
>             <from uri="timer://gps?fixedRate=true&amp;period=5000" />
>             <bean ref="randomWalkGenerator" method="pushCoord" />
>         </route>
>
>       </camel:camelContext>
>
>       <bean id="randomWalkGenerator"
> class="org.apache.camel.cometd.RandomStockGenerator" />
>
>
>
> Camel returns the following error :
>
> 11:10:09,697 | ERROR | gps              | TimerConsumer
> | rg.apache.camel.processor.Logger  248 | Error processing exchange. Exchan
> ge[Message: [Body is null]]. Caused by:
> [org.apache.camel.CamelExecutionException - Exception occurred during
> execution on the exchange: Exchange[Mess
> age: {amount=90.0, price=1800, symbol=MSFT}]]
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange: Exchange[Message: {amount=90.0, price=1800,
> symbol=MSFT
> }]
>         at
> org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1089)
>         at
> org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:448)
>         at
> org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:427)
>         at
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:105)
>         at
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:121)
>         at
> org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:269)
>         at
> org.apache.camel.cometd.RandomStockGenerator.pushCoord(RandomStockGenerator.java:43)
>         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.camel.component.bean.MethodInfo.invoke(MethodInfo.java:220)
>         at
> org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:139)
>         at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:138)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>         at
> org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
>         at
> org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
>         at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:161)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
>         at
> org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
>         at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)
>         at
> org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66)
>         at
> org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
>         at
> org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:102)
>         at
> org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:49)
>         at java.util.TimerThread.mainLoop(Timer.java:512)
>         at java.util.TimerThread.run(Timer.java:462)
> Caused by: org.apache.camel.ExchangeTimedOutException: The OUT message was
> not received within: 20000 millis. Exchange[Message: {amount=90.0, price=18
> 00, symbol=MSFT}]
>         at
> org.apache.camel.component.jms.JmsProducer.processInOut(JmsProducer.java:265)
>         at
> org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:147)
>         at
> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:214)
>         at
> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:192)
>         at
> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:173)
>         at
> org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:192)
>         at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:136)
>         at
> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:100)
>         at
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:104)
>         ... 27 more
>
> Do I have to change the MEP IntOut to InOnly on the producer ? If the
> answer is yes, How can I do that ?
>
> Kind regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
> Apache Camel Group :
> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message