camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Krasser <...@martin-krasser.de>
Subject Re: Resequencer pattern does not work with the StreamRequencer config
Date Mon, 20 Apr 2009 09:34:01 GMT
Hi Nawaz,

Some comments to your code:

- Technically you should be able to get the code working using 
constant(Long.valueOf("1000")) but this doesn't resequence the message 
because all will have the same sequence number
- How to customize the resequencer using sequence numbers other than 
long (in Camel 1.x) is also described in 
https://issues.apache.org/activemq/browse/CAMEL-1371. (The gapPredicate 
extension still needs to be implemented, but providing a custom 
comparator is already working).

Hope that helps,
Martin


Nawaz Ahmed schrieb:
> 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
>
>  
>
>
>   


Mime
View raw message