When i use Bindy in OSGI/Blueprint, i must declare:

<reference id="bindy" interface="org.apache.camel.spi.DataFormatResolver" timeout="30000"/>

if not declare this reference, my bundle stay in grace-period with Camel recent version.


Le 28/11/2015 17:32, Krzysztof Sobkowiak a écrit :
But the option type should select the correct one

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

The 3 data formats exist from a long time. Do you think, the <bindy> element 
will not work in OSGi?


On 28.11.2015 17:26, Claus Ibsen wrote:
I guess its due bindy is essentially 3 data formats
https://github.com/apache/camel/blob/master/components/camel-bindy/pom.xml#L37

But I guess we should just add bindy there as well.



On Sat, Nov 28, 2015 at 5:23 PM, Krzysztof Sobkowiak
<krzys.sobkow...@gmail.com> wrote:
2.16.1

On 28.11.2015 17:21, Claus Ibsen wrote:
What version of Camel are you using?

On Sat, Nov 28, 2015 at 5:06 PM, Krzysztof Sobkowiak
<krzys.sobkow...@gmail.com> wrote:
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/)
--
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/)


--
Jean-Baptiste Defard
Directeur Technique

Netapsys Conseil
124 - 126, rue de Provence
75008 Paris
Tél : +33 (0)1 70 64 27 42
Standard : +33 (0)1 70 64 27 33
Mob. : +33 (0)6 11 61 72 42
www.netapsys.fr <http://www.netapsys.fr> - blog.netapsys.fr <http://blog.netapsys.fr>
Netapsys - Ingénierie informatique
Paris - Lyon - Nantes - Strasbourg - Lille - Rennes - Antananarivo

Reply via email to