9 Replies Latest reply on Jun 17, 2013 7:41 AM by kcbabo

    How SY handles RuntimeCamelException?




      Camel has thrown GenericFileOperationFailedException but I cannot find anything in the log file about it. I am using SY 0.0.


      Thanks, Jan

        • 1. Re: How SY handles RuntimeCamelException?

          Which version? You typed "SY 0.0."

          • 2. Re: How SY handles RuntimeCamelException?

            That explains why the exceptions wanishes :-)


            SY 0.8.

            • 3. Re: How SY handles RuntimeCamelException?

              Tried to debug Camel and SY. When exception is thrown from GenericFileProducer, it is stored in camel's Exchange.setException(). It seems that returned Exchange is ignored in org.switchyard.component.camel.common.handler.OutboundHandler.handleInOnly(Exchange) and exception vanishes. Is this bug in SY or do I need to add something to switchyard.xml to handle them?


              Thanks, jan

              • 4. Re: How SY handles RuntimeCamelException?

                This is a bug w/r/t logging in 0.8 where the exception is actually logged at DEBUG level, which makes it invisible with the default logging configuration.  This has been fixed in 1.0.

                • 5. Re: How SY handles RuntimeCamelException?

                  I don't see any exception logged even with DEBUG level. I also tried to use camel onException or doTry/doCatch in RouteBuilder but I also don't see anything logged:





                  from("switchyard://Message2File"). // read message from JMS


                              to("switchyard://Message2FileReference"). // store as file, this throws because file already exists on FS





                  Does https://community.jboss.org/message/777021 also apply to SY 0.8 as my interface returns nothing?


                  public interface Message2File {

                      public void process(String payload);



                  Thank you, Jan

                  • 6. Re: How SY handles RuntimeCamelException?

                    The exception will not be propagated back to the camel route with an inonly MEP, so I wouldn't expect the try/catch above to work in that situation.


                    I would expect the DEBUG log to happen however.  Just to confirm, you set the log level for org.switchyard to DEBUG and updated the CONSOLE handler to print DEBUG as well?


                    This is something that has been bugging me for a while.  Lukasz and I discussed a potential solution about a month back.  I think we can make this a bit more intuitive for 1.0:


                    1 of 1 people found this helpful
                    • 7. Re: How SY handles RuntimeCamelException?

                      Thanks Keith for your time. I can confirm that org.switchyard is set to DEBUG and I use file log and I see DEBUG logs from switchyard. What class should log the exception?


                      I am new to SY/Camel so I am learning. What I need is to read a message out of a JMS queue and store it as a file with given name. For optimistic scenario it works but I want to handle errors that occur during file saving such as if the file already exists. In that case I may want to put the message to another queue or to another folder as I cannot loose it. I have no idea how should I implement it with SY 0.8 as onException nor doTry/doCatch does nothing.


                          <service name="Message2File" promote="Message2FileBuilder/Message2File">

                            <jms:binding.jms xmlns:jms="urn:switchyard-component-camel-jms:config:1.0">

                              <jms:contextMapper includes=".*" />






                          <component name="Message2FileBuilder">

                            <implementation.camel xmlns="urn:switchyard-component-camel:config:1.0">

                              <java class="cz.wood.switchyard.routes.Message2FileRouteBuilder" />



                            <service name="Message2File">

                              <interface.java interface="cz.wood.switchyard.services.Message2File" />



                            <reference multiplicity="1..1" name="Message2FileReference">

                              <swyd:interface.esb xmlns:swyd="urn:switchyard-config:switchyard:1.0" inputType="java:java.lang.String" />




                          <reference name="Message2FileReference" multiplicity="1..1" promote="Message2FileBuilder/Message2FileReference">

                            <file:binding.file xmlns:file="urn:switchyard-component-camel-file:config:1.0">

                              <file:contextMapper includes="CamelFileName" />








                      package cz.wood.switchyard.services;

                      public interface Message2File {

                          public void process(String payload);



                      @Route(value = Message2File.class)

                      public class Message2FileRouteBuilder extends RouteBuilder {



                                public void configure() throws Exception {


                                  setHeader(Exchange.FILE_NAME, header(Constants.MSG_HEADER_FILE_NAME)).





                      • 8. Re: How SY handles RuntimeCamelException?

                        Adding outputType to


                              <reference multiplicity="1..1" name="Message2FileReference">

                                <swyd:interface.esb xmlns:swyd="urn:switchyard-config:switchyard:1.0" inputType="java:java.lang.String" outputType="java:java.lang.String" />



                        made the needed change, Jan

                        • 9. Re: How SY handles RuntimeCamelException?

                          Thanks for the config.  Once SWITCHYARD-1534 is addressed you should be able to use an in-only MEP and still get runtime errors/faults reported.