Hi

Are you using Camel 1.x?

In Camel 2.0 it should use the Camel type converter system so it can
automatic convert it to a Long type that the resequencer requires.
In Camel 1.x you must provide a Long type as it uses the regular java
type converter = (Long).

And yes we should probably propagate this fix into Camel 1.x as well.
If you want to try out how to do this, then you can check the source
code for the file in trunk and compare it with the 1.x version.
And then create a patch and create a JIRA ticket and attach the patch.




On Mon, Apr 20, 2009 at 8:46 AM, Nawaz Ahmed <naah...@progress.com> wrote:
> Hi all,
>
>   I was going through the Resequencer camel component available in the
> link: http://camel.apache.org/resequencer.html
>
>
>
>   On trying the resequencer camel component with the StreamResequencer
> config with the code below:
>
>
>
>     from("jms:queue:nq1").
>
>     convertBodyTo(String.class).
>
>     resequencer(constant("1000")).stream(new
> StreamResequencerConfig()).
>
>     convertBodyTo(String.class).
>
>     to("jms:queue:nq2")
>
>
>
> I am getting the below Exception in the Console:
>
> java.lang.ClassCastException: java.lang.String
>
>      at
> org.apache.camel.processor.resequencer.DefaultExchangeComparator.getSequ
> enceNumber(DefaultExchangeComparator.java:81)
>
>      at
> org.apache.camel.processor.resequencer.DefaultExchangeComparator.compare
> (DefaultExchangeComparator.java:75)
>
>      at
> org.apache.camel.processor.resequencer.DefaultExchangeComparator.compare
> (DefaultExchangeComparator.java:38)
>
>      at
> org.apache.camel.processor.resequencer.ElementComparator.compare(Element
> Comparator.java:63)
>
>      at
> org.apache.camel.processor.resequencer.ElementComparator.compare(Element
> Comparator.java:28)
>
>      at
> org.apache.camel.processor.resequencer.Sequence.higher(Sequence.java:109
> )
>
>      at
> org.apache.camel.processor.resequencer.Sequence.successor(Sequence.java:
> 73)
>
>      at
> org.apache.camel.processor.resequencer.ResequencerEngine.insert(Resequen
> cerEngine.java:192)
>
>      at
> org.apache.camel.processor.StreamResequencer.process(StreamResequencer.j
> ava:167)
>
>      at
> org.apache.camel.management.InstrumentationProcessor.process(Instrumenta
> tionProcessor.java:80)
>
>      at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.j
> ava:185)
>
>      at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.j
> ava:132)
>
>      at org.apache.camel.processor.Pipeline.process(Pipeline.java:115)
>
>      at org.apache.camel.processor.Pipeline.process(Pipeline.java:89)
>
>      at
> org.apache.camel.management.InstrumentationProcessor.process(Instrumenta
> tionProcessor.java:68)
>
>      at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcess
> or.java:52)
>
>      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:72)
>
>      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(Unknown Source)
>
> Apr 20, 2009 12:12:51 PM org.apache.camel.processor.Logger log
>
> SEVERE: java.lang.String
>
>
>
> Is there any problem with the above code or Is it the bug in the
> Resequencer Camel component?
>
>
>
>
>
> Thanks and Regards,
>
> Nawaz Ahmed
>
>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration

Reply via email to