Camel
  1. Camel
  2. CAMEL-5191

JMX statistics problem with onException()

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Not a Problem
    • Affects Version/s: 2.9.2
    • Fix Version/s: 2.10.0
    • Component/s: camel-core
    • Labels:
      None
    • Environment:

      Camel 2.9.2 + Eclipse 3.6

    • Estimated Complexity:
      Unknown

      Description

      There is no JMX MBean for onException component, which makes statistics unavailable.

      For example:

      import javax.jms.ConnectionFactory;
      
      import org.apache.camel.CamelContext;
      import org.apache.camel.Exchange;
      import org.apache.camel.Processor;
      import org.apache.camel.builder.RouteBuilder;
      import org.apache.camel.impl.DefaultCamelContext;
      
      /**
       * A Camel Router
       */
      public class OnExceptionRouteBuilder extends RouteBuilder {
      
      	/**
      	 * A main() so we can easily run these routing rules in our IDE
      	 */
      	public static void main(String... args) throws Exception {
      
      		CamelContext camelContext = new DefaultCamelContext();
      
      		ConnectionFactory jmsConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory(
      				"tcp://localhost:61616");
      		camelContext.addComponent("jms",
      				org.apache.camel.component.jms.JmsComponent
      						.jmsComponent(jmsConnectionFactory));
      
      		camelContext.addRoutes(new OnExceptionRouteBuilder());
      
      		camelContext.start();
      
      		Thread.sleep(100000000);
      	}
      
      	/**
      	 * Lets configure the Camel routing rules using Java code...
      	 */
      	public void configure() {
      
      		onException(javax.jms.JMSException.class).process(new Processor() {
      
      			@Override
      			public void process(Exchange exchange) throws Exception {
      				System.out.println("error");
      
      			}
      		}).to("log:exception");
      
      		from("timer://myTimer?period=2000&repeatCount=1").setBody()
      				.simple("hello JMS!").process(new Processor() {
      
      					@Override
      					public void process(Exchange exchange) throws Exception {
      						System.out.println("We will write to ActiveMQ queue: "
      								+ exchange.getIn().getBody(String.class));
      
      					}
      				}).to("jms:queue:hello");
      
      	}
      
      }
      
      

      And there are only two processors(We have four in the test case) in org.apache.camel/processors, none for onException branch. See the picture attached.

        Activity

        XiaopengLi created issue -
        XiaopengLi made changes -
        Field Original Value New Value
        Description There is no JMX MBean for onException component, which makes statistics is not available.

        For example:
        {noformat}


        /**
        * A main() so we can easily run these routing rules in our IDE
        */
        public static void main(String... args) throws Exception {

        CamelContext camelContext = new DefaultCamelContext();

        ConnectionFactory jmsConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory(
        "tcp://localhost:61616");
        camelContext.addComponent("jms",
        org.apache.camel.component.jms.JmsComponent
        .jmsComponent(jmsConnectionFactory));

        camelContext.addRoutes(new OnExceptionRouteBuilder());

        camelContext.start();

        Thread.sleep(100000000);
        }

        /**
        * Lets configure the Camel routing rules using Java code...
        */
        public void configure() {

        onException(javax.jms.JMSException.class).process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("error");

        }
        }).to("log:exception");

        from("timer://myTimer?period=2000&repeatCount=1").setBody()
        .simple("hello JMS!").process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("We will write to ActiveMQ queue: "
        + exchange.getIn().getBody(String.class));

        }
        }).to("jms:queue:hello");

        }


        {noformat}

        And there are only two processors in org.apache.camel/processors, none for onException branch. See the picture attached.
        There is no JMX MBean for onException component, which makes statistics is not available.

        For example:
        {noformat}

        import javax.jms.ConnectionFactory;

        import org.apache.camel.CamelContext;
        import org.apache.camel.Exchange;
        import org.apache.camel.Processor;
        import org.apache.camel.builder.RouteBuilder;
        import org.apache.camel.impl.DefaultCamelContext;

        /**
         * A Camel Router
         */
        public class OnExceptionRouteBuilder extends RouteBuilder {

        /**
        * A main() so we can easily run these routing rules in our IDE
        */
        public static void main(String... args) throws Exception {

        CamelContext camelContext = new DefaultCamelContext();

        ConnectionFactory jmsConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory(
        "tcp://localhost:61616");
        camelContext.addComponent("jms",
        org.apache.camel.component.jms.JmsComponent
        .jmsComponent(jmsConnectionFactory));

        camelContext.addRoutes(new OnExceptionRouteBuilder());

        camelContext.start();

        Thread.sleep(100000000);
        }

        /**
        * Lets configure the Camel routing rules using Java code...
        */
        public void configure() {

        onException(javax.jms.JMSException.class).process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("error");

        }
        }).to("log:exception");

        from("timer://myTimer?period=2000&repeatCount=1").setBody()
        .simple("hello JMS!").process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("We will write to ActiveMQ queue: "
        + exchange.getIn().getBody(String.class));

        }
        }).to("jms:queue:hello");

        }

        }

        {noformat}

        And there are only two processors in org.apache.camel/processors, none for onException branch. See the picture attached.
        XiaopengLi made changes -
        Attachment screenshot-1.jpg [ 12523290 ]
        XiaopengLi made changes -
        Description There is no JMX MBean for onException component, which makes statistics is not available.

        For example:
        {noformat}

        import javax.jms.ConnectionFactory;

        import org.apache.camel.CamelContext;
        import org.apache.camel.Exchange;
        import org.apache.camel.Processor;
        import org.apache.camel.builder.RouteBuilder;
        import org.apache.camel.impl.DefaultCamelContext;

        /**
         * A Camel Router
         */
        public class OnExceptionRouteBuilder extends RouteBuilder {

        /**
        * A main() so we can easily run these routing rules in our IDE
        */
        public static void main(String... args) throws Exception {

        CamelContext camelContext = new DefaultCamelContext();

        ConnectionFactory jmsConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory(
        "tcp://localhost:61616");
        camelContext.addComponent("jms",
        org.apache.camel.component.jms.JmsComponent
        .jmsComponent(jmsConnectionFactory));

        camelContext.addRoutes(new OnExceptionRouteBuilder());

        camelContext.start();

        Thread.sleep(100000000);
        }

        /**
        * Lets configure the Camel routing rules using Java code...
        */
        public void configure() {

        onException(javax.jms.JMSException.class).process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("error");

        }
        }).to("log:exception");

        from("timer://myTimer?period=2000&repeatCount=1").setBody()
        .simple("hello JMS!").process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("We will write to ActiveMQ queue: "
        + exchange.getIn().getBody(String.class));

        }
        }).to("jms:queue:hello");

        }

        }

        {noformat}

        And there are only two processors in org.apache.camel/processors, none for onException branch. See the picture attached.
        There is no JMX MBean for onException component, which makes statistics is not available.

        For example:
        {noformat}

        import javax.jms.ConnectionFactory;

        import org.apache.camel.CamelContext;
        import org.apache.camel.Exchange;
        import org.apache.camel.Processor;
        import org.apache.camel.builder.RouteBuilder;
        import org.apache.camel.impl.DefaultCamelContext;

        /**
         * A Camel Router
         */
        public class OnExceptionRouteBuilder extends RouteBuilder {

        /**
        * A main() so we can easily run these routing rules in our IDE
        */
        public static void main(String... args) throws Exception {

        CamelContext camelContext = new DefaultCamelContext();

        ConnectionFactory jmsConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory(
        "tcp://localhost:61616");
        camelContext.addComponent("jms",
        org.apache.camel.component.jms.JmsComponent
        .jmsComponent(jmsConnectionFactory));

        camelContext.addRoutes(new OnExceptionRouteBuilder());

        camelContext.start();

        Thread.sleep(100000000);
        }

        /**
        * Lets configure the Camel routing rules using Java code...
        */
        public void configure() {

        onException(javax.jms.JMSException.class).process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("error");

        }
        }).to("log:exception");

        from("timer://myTimer?period=2000&repeatCount=1").setBody()
        .simple("hello JMS!").process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("We will write to ActiveMQ queue: "
        + exchange.getIn().getBody(String.class));

        }
        }).to("jms:queue:hello");

        }

        }

        {noformat}

        And there are only two processors(We have four in the test case) in org.apache.camel/processors, none for onException branch. See the picture attached.
        XiaopengLi made changes -
        Description There is no JMX MBean for onException component, which makes statistics is not available.

        For example:
        {noformat}

        import javax.jms.ConnectionFactory;

        import org.apache.camel.CamelContext;
        import org.apache.camel.Exchange;
        import org.apache.camel.Processor;
        import org.apache.camel.builder.RouteBuilder;
        import org.apache.camel.impl.DefaultCamelContext;

        /**
         * A Camel Router
         */
        public class OnExceptionRouteBuilder extends RouteBuilder {

        /**
        * A main() so we can easily run these routing rules in our IDE
        */
        public static void main(String... args) throws Exception {

        CamelContext camelContext = new DefaultCamelContext();

        ConnectionFactory jmsConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory(
        "tcp://localhost:61616");
        camelContext.addComponent("jms",
        org.apache.camel.component.jms.JmsComponent
        .jmsComponent(jmsConnectionFactory));

        camelContext.addRoutes(new OnExceptionRouteBuilder());

        camelContext.start();

        Thread.sleep(100000000);
        }

        /**
        * Lets configure the Camel routing rules using Java code...
        */
        public void configure() {

        onException(javax.jms.JMSException.class).process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("error");

        }
        }).to("log:exception");

        from("timer://myTimer?period=2000&repeatCount=1").setBody()
        .simple("hello JMS!").process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("We will write to ActiveMQ queue: "
        + exchange.getIn().getBody(String.class));

        }
        }).to("jms:queue:hello");

        }

        }

        {noformat}

        And there are only two processors(We have four in the test case) in org.apache.camel/processors, none for onException branch. See the picture attached.
        There is no JMX MBean for onException component, which makes statistics unavailable.

        For example:
        {noformat}

        import javax.jms.ConnectionFactory;

        import org.apache.camel.CamelContext;
        import org.apache.camel.Exchange;
        import org.apache.camel.Processor;
        import org.apache.camel.builder.RouteBuilder;
        import org.apache.camel.impl.DefaultCamelContext;

        /**
         * A Camel Router
         */
        public class OnExceptionRouteBuilder extends RouteBuilder {

        /**
        * A main() so we can easily run these routing rules in our IDE
        */
        public static void main(String... args) throws Exception {

        CamelContext camelContext = new DefaultCamelContext();

        ConnectionFactory jmsConnectionFactory = new org.apache.activemq.ActiveMQConnectionFactory(
        "tcp://localhost:61616");
        camelContext.addComponent("jms",
        org.apache.camel.component.jms.JmsComponent
        .jmsComponent(jmsConnectionFactory));

        camelContext.addRoutes(new OnExceptionRouteBuilder());

        camelContext.start();

        Thread.sleep(100000000);
        }

        /**
        * Lets configure the Camel routing rules using Java code...
        */
        public void configure() {

        onException(javax.jms.JMSException.class).process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("error");

        }
        }).to("log:exception");

        from("timer://myTimer?period=2000&repeatCount=1").setBody()
        .simple("hello JMS!").process(new Processor() {

        @Override
        public void process(Exchange exchange) throws Exception {
        System.out.println("We will write to ActiveMQ queue: "
        + exchange.getIn().getBody(String.class));

        }
        }).to("jms:queue:hello");

        }

        }

        {noformat}

        And there are only two processors(We have four in the test case) in org.apache.camel/processors, none for onException branch. See the picture attached.
        Hide
        Claus Ibsen added a comment -
        Show
        Claus Ibsen added a comment - Working as designed. See this FAQ http://camel.apache.org/why-is-my-processor-not-showing-up-in-jconsole.html
        Claus Ibsen made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Claus Ibsen [ davsclaus ]
        Fix Version/s 2.10.0 [ 12317612 ]
        Resolution Not A Problem [ 8 ]

          People

          • Assignee:
            Claus Ibsen
            Reporter:
            XiaopengLi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development