camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krzysztof Sobkowiak <krzys.sobkow...@gmail.com>
Subject camel-bindy & OSGi
Date Sat, 28 Nov 2015 16:06:56 GMT

Hi

I have following route

<route id="order-service-normalizer-route">
    <from uri="amq:incomingOrders"/>
    <choice>
        <when>
            <simple>${header.CamelFileName} regex '^.*xml$'</simple>
            <unmarshal>
                <jaxb contextPath="org.sobkowiak.demos.order.common"/>
            </unmarshal>
        </when>
        <when>
            <simple>${header.CamelFileName} regex '^.*(csv|csl)$'</simple>
<unmarshal>
                <bindy classType="org.sobkowiak.demos.order.common.Order" type="Csv"/>
            </unmarshal>
            <convertBodyTo type="org.sobkowiak.demos.order.common.Order"/>
        </when>
    </choice>
    <to uri="amq:orders"/>
</route>


I have installed camel-bindy feature under ServiceMix. While installing my bundle my bundle
remains in GracePeriod status and I can see following log entry.

2015-11-28 16:58:57,480 | INFO  | l for user karaf | BlueprintContainerImpl           | 15
- org.apache.aries.blueprint.core - 1.4.4 | Bundle org.sobkowiak.demos.order-service-normalizer/1.0.0.SNAPSHOT
is waiting for dependencies [(&(dataformat=bindy)(objectClass=org.apache.camel.spi.DataFormatResolver))]

After changing to this form, it works for me


<dataFormats>
        <bindy id="bindyDataFormat" classType="org.sobkowiak.demos.order.common.Order"
type="Csv"/>
    </dataFormats>


    <route id="order-service-normalizer-route">
        <from uri="amq:incomingOrders"/>
        <choice>
            <when>
                <simple>${header.CamelFileName} regex '^.*xml$'</simple>
                <unmarshal>
                    <jaxb contextPath="org.sobkowiak.demos.order.common"/>
                </unmarshal>
            </when>
            <when>
                <simple>${header.CamelFileName} regex '^.*(csv|csl)$'</simple>
                <unmarshal ref="bindyDataFormat"/>S
                <!--<unmarshal> <bindy classType="org.sobkowiak.demos.order.common.Order"
type="Csv"/> </unmarshal>--> <convertBodyTo type="org.sobkowiak.demos.order.common.Order"/>
            </when>
        </choice>
        <to uri="amq:orders"/>
    </route>
</camelContext>




I think the second route works because I define the binding data format in my blueprint file.
In the first case not. Am I missing something?

Regards
Krzysztof



-- 
Krzysztof Sobkowiak

JEE & OSS Architect, Integration Architect
Apache Software Foundation Member (http://apache.org/)
Apache ServiceMix Committer & PMC Member (http://servicemix.apache.org/)
Senior Solution Architect @ Capgemini SSC (http://www.capgeminisoftware.pl/)


33rd Degree 4charity (http://2015.33degree.org/)

Mime
View raw message