camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" <claus.ib...@gmail.com>
Subject Re: Meet a problem when using recipientlist
Date Thu, 20 Nov 2008 08:33:04 GMT
BTW: What version of Camel are you using? I think I recall that such
an issue is fixed in Camel 1.5.0 or 1.5.1

/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/



On Thu, Nov 20, 2008 at 9:24 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> Hi
>
> What does your bean look like?
>>                <methodCall bean="router" method="route"/>
>
> I think the issue is that the payload from servicemix is XML and Camel
> will try to find coerce the payload to the type you have defined in
> your bean.
>
> So you can change the signature to use Exchange as type then there
> shouldn't take any type conventions place.
>
>
>
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
>
>
>
> On Thu, Nov 20, 2008 at 9:11 AM, Jackey Ding <novthirteen@gmail.com> wrote:
>> Hi,
>>
>> I want to wirte a bean dynamically determine what endpoints will be invoked
>> when a service is called. It seems that dynamic recipientlist can meet my
>> demand. I wrote a simple method just return a string as endpoint name, and
>> got the error message as below:
>>
>> info: Outbound Message
>> ---------------------------
>> Encoding: UTF-8
>> Headers:
>> Messages:
>> Payload: <soap:Envelope xmlns:soap="
>> http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:getBillingCountResponse
>> xmlns:ns1="http://mm.service.integration.symphony
>> "><return>1</return></ns1:getBillingCountResponse></soap:Body></soap:Envelope>
>> --------------------------------------
>> 2008-11-20 15:36:36 org.apache.camel.processor.Logger log
>> error: Failed delivery for exchangeId: ID-mycomputer/3353-1227166593020/0-0.
>> On delivery attempt: 0 caught:
>> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
>> invoke method: route on router due to:
>> org.apache.camel.NoTypeConversionAvailableException: No type converter
>> available to convert from type: class [Ljava.lang.String; to the required
>> type: javax.xml.transform.Source with value [Ljava.lang.String;@1f3329a
>> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
>> invoke method: route on router due to:
>> org.apache.camel.NoTypeConversionAvailableException: No type converter
>> available to convert from type: class [Ljava.lang.String; to the required
>> type: javax.xml.transform.Source with value [Ljava.lang.String;@1f3329a
>>    at
>> org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:79)
>>    at
>> org.apache.camel.processor.RecipientList.process(RecipientList.java:58)
>>    at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:75)
>>    at
>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:172)
>>    at
>> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:93)
>>    at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:63)
>>    at
>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:47)
>>    at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
>>    at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
>>    at
>> org.apache.servicemix.camel.CamelProviderEndpoint.handleActiveProviderExchange(CamelProviderEndpoint.java:115)
>>    at
>> org.apache.servicemix.camel.CamelProviderEndpoint.process(CamelProviderEndpoint.java:73)
>>    at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:600)
>>    at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:554)
>>    at
>> org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:510)
>>    at
>> org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
>>    at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620)
>>    at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
>>    at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
>>    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)
>> Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
>> converter available to convert from type: class [Ljava.lang.String; to the
>> required type: javax.xml.transform.Source with value
>> [Ljava.lang.String;@1f3329a
>>    at
>> org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:117)
>>    at
>> org.apache.camel.util.ExchangeHelper.convertToType(ExchangeHelper.java:180)
>>    at
>> org.apache.servicemix.camel.JbiBinding.convertBodyToJbi(JbiBinding.java:61)
>>    at org.apache.servicemix.camel.JbiMessage.setBody(JbiMessage.java:159)
>>    at
>> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:125)
>>    at
>> org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:76)
>>    ... 21 more
>>
>>
>> my configuration is
>> <bean id="router"
>>        class="symphony.integration.service.mm.BillingServiceRouter" />
>>
>>    <camelContext id="camelContext" useJmx="true"
>>        xmlns="http://activemq.apache.org/camel/schema/spring">
>>        <route>
>>            <from
>>                uri="jbi:endpoint:
>> http://mm.service.integration.symphony/BillingServiceCamelRouter/BillingServicePort"
>> />
>>            <recipientList>
>>                <methodCall bean="router" method="route"/>
>>            </recipientList>
>>        </route>
>>    </camelContext>
>>
>> my bean, just return a string.
>> @RecipientList
>>    public String[] route(String body) {
>>        return new String[]{"jbi:endpoint:
>> http://mm.service.integration.symphony/BillingService/BillingServicePort"};
>>    }
>>
>> It's weird, when change config to point-to-point mode it works fine.
>>        <route>
>>            <from
>>                uri="jbi:endpoint:
>> http://mm.service.integration.symphony/BillingServiceCamelRouter/BillingServicePort"
>> />
>>            <to
>>                uri="jbi:endpoint:
>> http://mm.service.integration.symphony/BillingService/BillingServicePort" />
>>        </route>
>>
>> Thanks & best regards
>>
>

Mime
View raw message