1 2 3 Previous Next 34 Replies Latest reply on Sep 14, 2009 3:59 PM by muellerc Go to original post
      • 30. Re: How to use camel-jaxb in fuse esb (4.1.0.0)
        davsclaus

        Is the version correct or just the kernel displaying 1.0.0.0 instead of something thats related to SNAPSHOT?

         

        It should be: 1.x-fuse-SNAPSHOT as in the maven  tag.

        • 31. Re: How to use camel-jaxb in fuse esb (4.1.0.0)
          muellerc

          I updated my project to FUSE ESB 4.1.0.2 and camel (1.6.1.0-fuse) and tried it out. My route definition was:

           

          from("file:///Users/muellerc/tmp/incomingEvents")

          .convertBodyTo(Matrics.class)

          .process(new Processor() {

               public void process(Exchange exchange) throws Exception {

                    logger.info("the body class is: " + exchange.getIn().getBody().getClass());

               }

          })

          .to("file:///Users/muellerc/tmp/outgoingEvents");

           

          and receive the log messages:

           

          23:34:08,866 | WARN  | Component@5306bb | ConvertBodyProcessor             | l.processor.ConvertBodyProcessor   46 | Could not convert body of IN message: FileMessage: /Users/muellerc/tmp/incomingEvents/sample_event.xml to type: de.ps4b.rfid.model.matrics.Matrics

          23:34:08,867 | INFO  | Component@5306bb | FileEventReader                  | ps4b.rfid.file.FileEventReader$1   21 | the body class is: class java.io.File

           

          So, for me it looks like, the "problem" is not fixed yet.

           

          Regards,

          Christian

          • 32. Re: How to use camel-jaxb in fuse esb (4.1.0.0)
            jkhan

            I am having an issue in Camel route when I consume from JBI consumer endpoint and using JAXB parser. Here is the flow:

            ServiceMix-JMS ->convertBodyTo-> unmarshalJAXB ->Process

            I am getting exception for java.io.IOException: Unable to create context when I use a consumer as Servicemix-JMS. But this works fine when I read from file or camel-jms.

            Attached are the camel-jaxb.zip and servicemix.log files. The camel-jaxb.zip contains bridge-camel-sa, bridge-jms-su, pom.xml and rider-auto-example. The OrderRouter.java has the RouteBuilder inside rider-auto-example which I got from this thread  How do I fix this issue?

               public void configure() throws Exception {
                    JaxbDataFormat jaxb = new JaxbDataFormat("org.fusesource.camel");
                      ActiveMQConnectionFactory act=new ActiveMQConnectionFactory("tcp://localhost:61616");
                      this.getContext().addComponent("ActiveMQ", JmsComponent.jmsComponentAutoAcknowledge(act));
            
            //        from("file:target/placeorder")
            //          from("ActiveMQ:queue:Queue.RQ")                         // 1
                    from("jbi:service:http://my.company.com/example/1.0/MyRoutingService")
                    .to("log:lab1-jbi")
                      .convertBodyTo(String.class)
                      .unmarshal(jaxb)
                      .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            System.out.println("the body class is: " + exchange.getIn().getBody().getClass());
                        }
                      });
                }
            

            You can use any jms client to put messages on the QUEUE.RQ

            I did open JIRA about this which http://fusesource.com/issues/browse/DEV-1761

            Thanks

            Jawed

             

            Edited by: jkhan on Sep 9, 2009 5:00 PM

            • 33. Re: How to use camel-jaxb in fuse esb (4.1.0.0)
              njiang

              Hi Christian,

               

              There is no converter can turn the file message into a JAXB object that your want.

              Can you try to use the .convertBodyTo(InputStream.class) to turn the file message into a InputStream frist ?

              I think this time the JAXB fallback converter can begin to work

               

              Willem

              • 34. Re: How to use camel-jaxb in fuse esb (4.1.0.0)
                muellerc

                Hey Willem,

                 

                I have changed the route as you have suggested:

                 

                     public void configure() throws Exception {
                          from("file:///Users/muellerc/tmp/incomingEvents")
                               .convertBodyTo(InputStream.class)
                               .convertBodyTo(Matrics.class)
                               .process(new Processor() {
                                    public void process(Exchange exchange) throws Exception {
                                         logger.info("the body class is: " + exchange.getIn().getBody().getClass());
                                    }
                               })
                               .to("file:///Users/muellerc/tmp/outgoingEvents");
                     }
                

                 

                But it dosn't work

                 

                21:52:45,033 | WARN  | omponent@2116aeb | ConvertBodyProcessor             | l.processor.ConvertBodyProcessor   46 | Could not convert body of IN message: FileMessage: /Users/muellerc/tmp/incomingEvents/sample_event.xml to type: de.ps4b.rfid.model.matrics.Matrics
                21:52:45,034 | INFO  | omponent@2116aeb | FileEventReader                  | ps4b.rfid.file.FileEventReader$1   24 | the body class is: class java.io.File
                

                 

                Regards,

                Christian

                1 2 3 Previous Next