2 Replies Latest reply: May 9, 2012 10:03 PM by alex liu RSS

    camel-bindy is not supported,csv marshal and unmarshal

    alex liu Newbie

      In the latest apache camel 2.9,we can use csv marshal and unmarshal through camel-bindy.

      i  also hope switchyard next version will support it.

      1.Now i try to config the switchyard/component/camel/main/module.xml,add the follows:

        <module name="org.apache.camel.bindy" export="true" optional="true">

                  <imports>

                      <include path="META-INF/services/org/apache/camel/dataformat"/>

                  </imports>

                  <exports>

                      <include path="META-INF/services/org/apache/camel/dataformat"/>

                  </exports>

              </module>

       

      2.also add camel-bindy-2.8.0.jar and module.xml to modules\org\apache\camel\bindy\main.

      <module xmlns="urn:jboss:module:1.0" name="org.apache.camel.bindy">

          <resources>
              <resource-root path="camel-bindy-2.8.0.jar"/>
          </resources>

          <dependencies>
              <module name="javax.api"/>
              <module name="org.apache.camel.core"/>
              <module name="org.apache.camel.spring"/>
              <module name="org.apache.commons.logging"/>       
              <module name="org.springframework"/>
              <module name="org.slf4j"/>
          </dependencies>
      </module>

      3.add some code to config the csvModel

      @CsvRecord(separator=",")

      public class CategoryModel {

      @DataField(pos = 1)

      private String col1;

      @DataField(pos = 2)

      private String col2;

      4.add one route .unmarshal().bindy(BindyType.Csv, "csvModel")

      5.also config one route ,<camel:binding.camel configURI="file:d://test?fileName=test.csv"

      6.deploy this jar ,and consume this csv file to camel , i get errors:

       

      Fault generated during exchange without a handler: org.switchyard.HandlerException: java.lang.IllegalArgumentException: The separator has not been defined in the annotation @CsvRecord or not instantiated during initModel. must be specified