-ram,

I'm not sure if you have to switch to the Java DSL but I don't know how to
solve your problem using the XML configuration. Maybe someone else does?

Cheers,
Martin

> -----Ursprüngliche Nachricht-----
> Von: rmunjuluri [mailto:[EMAIL PROTECTED]
> Gesendet: Dienstag, 27. Mai 2008 12:34
> An: [email protected]
> Betreff: Re: AW: Resequencer based on XML Message header element
> (MessageId)
> 
> 
> Martin,
> 
> Thank you very much. Does this mean that I have to switch to using DSL and
> nor the XML configuration path using a simple camel-context.xml?
> 
> thanx
> -ram
> 
> Martin Krasser wrote:
> >
> > -ram,
> >
> > that's not an issue with your XML parser, the problem is that the
> > resequencer cannot compare the evaluation results of the xpath
> expression.
> > What you additionally need is to convert the evaluation result
> >
> > * to a java.lang.Comparable if you use the batch resequencer.
> > * to a java.lang.Long if you use the stream resequencer
> >
> > First, import statically ExpressionBuilder.convertTo.
> >
> > With a batch resequencer you may convert the xpath result to a String
> that
> > is comparable by the resequencer:
> >
> > from("...").resequence(convertTo(xpath("/MessageId"),
> > String.class)).to("...").
> >
> > With a stream resequencer (as in your example) you need a conversion to
> > Long
> > (I couldn't find a way for direct conversion of a DTMNode to Long but it
> > works with an intermediate String result. Maybe someone else knows a
> more
> > elegant way for that)
> >
> > from("...").resequence(convertTo(convertTo(xpath("/MessageId"),
> > String.class), Long.class)).stream().to("...").
> >
> > Hope that helps!
> >
> > Cheers,
> > Martin
> >
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: rmunjuluri [mailto:[EMAIL PROTECTED]
> >> Gesendet: Montag, 26. Mai 2008 22:41
> >> An: [email protected]
> >> Betreff: Re: Resequencer based on XML Message header element
> (MessageId)
> >>
> >>
> >> Gret,
> >>
> >> thanx. I tried using /MessageId in my camel-context.xml configuration,
> >> but
> >> when I send the messages, I get the following exception
> >>
> >> ===============
> >> ERROR - DeadLetterChannel              - Failed delivery for
> exchangeId:
> >> ID-enterprise/3871-1211806959515/0-29
> >> . On delivery attempt: 0 caught: java.lang.ClassCastException:
> >> com.sun.org.apache.xml.internal.dtm.ref.DTMNode
> >> List
> >> java.lang.ClassCastException:
> >> com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList
> >>         at
> >>
> org.apache.camel.processor.resequencer.DefaultExchangeComparator.getSequen
> >> ceNumber(DefaultExchangeC
> >> omparator.java:81)
> >>         at
> >>
> org.apache.camel.processor.resequencer.DefaultExchangeComparator.compare(D
> >> efaultExchangeComparator.
> >> java:75)
> >>         at
> >>
> org.apache.camel.processor.resequencer.DefaultExchangeComparator.compare(D
> >> efaultExchangeComparator.
> >> java:38)
> >>         at
> >>
> org.apache.camel.processor.resequencer.ElementComparator.compare(ElementCo
> >> mparator.java:63)
> >>         at
> >>
> org.apache.camel.processor.resequencer.ElementComparator.compare(ElementCo
> >> mparator.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(Resequence
> >> rEngine.java:236)
> >>         at
> >>
> org.apache.camel.processor.resequencer.ResequencerEngine.put(ResequencerEn
> >> gine.java:197)
> >>         at
> >>
> org.apache.camel.processor.StreamResequencer.process(StreamResequencer.jav
> >> a:88)
> >>         at
> >>
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsy
> >> nProcessorBridge.process(
> >> AsyncProcessorTypeConverter.java:44)
> >>         at
> >>
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.jav
> >> a:146)
> >>         at
> >>
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.jav
> >> a:90)
> >>         at
> >>
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor
> >> .java:40)
> >>         at
> >>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.ja
> >> va:44)
> >>         at
> >>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncPro
> >> cessor.java:68)
> >>         at
> >>
> org.apache.servicemix.camel.CamelJbiEndpoint.processInOnly(CamelJbiEndpoin
> >> t.java:64)
> >>         at
> >>
> org.apache.servicemix.common.endpoints.ProviderEndpoint.process(ProviderEn
> >> dpoint.java:100)
> >>         at
> >>
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCyc
> >> le.java:538)
> >>         at
> >>
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseL
> >> ifeCycle.java:490)
> >>         at
> >>
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle
> >> .java:46)
> >>         at
> >>
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(Del
> >> iveryChannelImpl.java:610
> >> )
> >>         at
> >>
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.jav
> >> a:172)
> >>         at
> >>
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:1
> >> 67)
> >>         at
> >>
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134
> >> )
> >>         at
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.
> >> java:650)
> >>         at
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java
> >> :675)
> >>         at java.lang.Thread.run(Thread.java:595)
> >> ERROR - DeadLetterChannel              - Failed delivery for
> exchangeId:
> >> ID-enterprise/3871-1211806959515/0-30
> >> . On delivery attempt: 0 caught: java.lang.ClassCastException:
> >> com.sun.org.apache.xml.internal.dtm.ref.DTMNode
> >> List
> >> java.lang.ClassCastException:
> >> com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList
> >>         at
> >>
> org.apache.camel.processor.resequencer.DefaultExchangeComparator.getSequen
> >> ceNumber(DefaultExchangeC
> >> omparator.java:81)
> >>         at
> >>
> org.apache.camel.processor.resequencer.DefaultExchangeComparator.compare(D
> >> efaultExchangeComparator.
> >> java:75)
> >>         at
> >>
> org.apache.camel.processor.resequencer.DefaultExchangeComparator.compare(D
> >> efaultExchangeComparator.
> >> java:38)
> >>         at
> >>
> org.apache.camel.processor.resequencer.ElementComparator.compare(ElementCo
> >> mparator.java:63)
> >>         at
> >>
> org.apache.camel.processor.resequencer.ElementComparator.compare(ElementCo
> >> mparator.java:28)
> >>         at java.util.TreeMap.compare(TreeMap.java:1093)
> >>         at java.util.TreeMap.put(TreeMap.java:465)
> >>         at java.util.TreeSet.add(TreeSet.java:210)
> >>         at
> >>
> org.apache.camel.processor.resequencer.ResequencerEngine.insert(Resequence
> >> rEngine.java:234)
> >>         at
> >>
> org.apache.camel.processor.resequencer.ResequencerEngine.put(ResequencerEn
> >> gine.java:197)
> >>         at
> >>
> org.apache.camel.processor.StreamResequencer.process(StreamResequencer.jav
> >> a:88)
> >>
> >>
> >>
> >> ===================
> >> Here is my routing config.
> >>
> >> ==============
> >> <!-- Batch Resequencer -->
> >>       <route>
> >>         <from
> >>
> uri="jbi:endpoint:http://consumers.pictor.com//CamelResequencerService/Cam
> >> elResequencerEndpoint"/>
> >>        <resequencer>
> >>           <xpath>/MessageId</xpath>
> >>           <to
> >> uri="jbi:service:http://services.pictor.com//CamelAJMSProvider"/>
> >>           <stream-config batchsize="2" batchTimeout="1000"/>
> >>         </resequencer>
> >>       </route>
> >> ==============================
> >>
> >> I found some explanation on the exception at
> >> http://saloon.javaranch.com/cgi-
> >> bin/ubb/ultimatebb.cgi?ubb=get_topic&f=1&t=015044
> >>
> >> it says there there is an error with return type on the xpath.evaluate.
> >> is
> >> this a version issue with the XML parser I have?
> >>
> >> thanx
> >> -ram
> >>
> >>
> >>
> >>
> >>
> >>
> >> Gert Vanthienen wrote:
> >> >
> >> > -ram,
> >> >
> >> > You should be able to do this with
> >> > from("...").resequence(xpath("/MessageId")).to("...").  Don't forget
> to
> >> > do the static import for the XPathBuilder.xpath method first.
> >> >
> >> > Gert
> >> >
> >> > rmunjuluri wrote:
> >> >> Hello,
> >> >>
> >> >> I am trying of the Resequencer EIP in camel and sending simple XML
> >> >> messages
> >> >> with in random order.
> >> >>
> >> >> [java] INFO  [ActiveMQOnewaySender] Sending (0)-
> >> <MessageId>1</MessageId>
> >> >> [java] INFO  [ActiveMQOnewaySender] Sending (1)-
> >> <MessageId>6</MessageId>
> >> >> [java] INFO  [ActiveMQOnewaySender] Sending (2)-
> >> <MessageId>7</MessageId>
> >> >> [java] INFO  [ActiveMQOnewaySender] Sending (3)-
> >> <MessageId>4</MessageId>
> >> >> [java] INFO  [ActiveMQOnewaySender] Sending (4)-
> >> <MessageId>8</MessageId>
> >> >> [java] INFO  [ActiveMQOnewaySender] Sending (5)-
> >> <MessageId>2</MessageId>
> >> >> [java] INFO  [ActiveMQOnewaySender] Sending (6)-
> >> <MessageId>5</MessageId>
> >> >> [java] INFO  [ActiveMQOnewaySender] Sending (7)-
> >> <MessageId>0</MessageId>
> >> >> [java] INFO  [ActiveMQOnewaySender] Sending (8)-
> >> <MessageId>3</MessageId>
> >> >> [java] INFO  [ActiveMQOnewaySender] Sending (9)-
> >> <MessageId>9</MessageId>
> >> >>
> >> >> As per my understanding I should be able to receive the messages at
> >> the
> >> >> other end in a resequenced order. the issue I have is I didnt find
> any
> >> >> samples XPATH expressions I could use to set in the camel route. I
> >> came
> >> >> across the jbi.Message based resequence expressions but not for XML
> >> >> messages. Is it possible at all to resequence based on XML message
> >> >> headers
> >> >> flowing in ServiceMix? or didnt I look at the right place for the a
> >> >> sample
> >> >> that does this?
> >> >>
> >> >> thanx
> >> >> -ram
> >> >>
> >> >
> >> >
> >> >
> >> > -----
> >> > ---
> >> > Gert Vanthienen
> >> > http://www.anova.be
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/Resequencer-based-
> on-
> >> XML-Message-header-element-%28MessageId%29-
> tp17454593s22882p17478861.html
> >> Sent from the Camel - Users mailing list archive at Nabble.com.
> >
> >
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/Resequencer-based-on-
> XML-Message-header-element-%28MessageId%29-tp17454593s22882p17487469.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Reply via email to