You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "XiaopengLi (Updated) (JIRA)" <ji...@apache.org> on 2012/04/19 04:42:40 UTC

[jira] [Updated] (CAMEL-5191) JMX statistics problem with onException()

     [ https://issues.apache.org/jira/browse/CAMEL-5191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

XiaopengLi updated CAMEL-5191:
------------------------------

    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.


  was:
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.


    
> JMX statistics problem with onException()
> -----------------------------------------
>
>                 Key: CAMEL-5191
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5191
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.9.2
>         Environment: Camel 2.9.2 + Eclipse 3.6
>            Reporter: XiaopengLi
>            Priority: Minor
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira