org.apache.camel.spi.ManagementStrategy Java Examples
The following examples show how to use
org.apache.camel.spi.ManagementStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CamelMicroProfileMetricsRecorder.java From camel-quarkus with Apache License 2.0 | 6 votes |
@Override public void customize(CamelContext camelContext) { if (config.enableRoutePolicy) { camelContext.addRoutePolicyFactory(new MicroProfileMetricsRoutePolicyFactory()); } ManagementStrategy managementStrategy = camelContext.getManagementStrategy(); if (config.enableExchangeEventNotifier) { managementStrategy.addEventNotifier(new MicroProfileMetricsExchangeEventNotifier()); } if (config.enableRouteEventNotifier) { managementStrategy.addEventNotifier(new MicroProfileMetricsRouteEventNotifier()); } if (config.enableCamelContextEventNotifier) { managementStrategy.addEventNotifier(new MicroProfileMetricsCamelContextEventNotifier()); } }
Example #2
Source File: JmxNamingPatternCamelApplication.java From camel-cookbook-examples with Apache License 2.0 | 5 votes |
public void setup() throws Exception { context = new DefaultCamelContext(); context.setNameStrategy(new ExplicitCamelContextNameStrategy("myCamelContextName")); final ManagementStrategy managementStrategy = context.getManagementStrategy(); final ManagementAgent managementAgent = managementStrategy.getManagementAgent(); managementAgent.setMBeanServerDefaultDomain("org.apache.camel"); final ManagementNameStrategy managementNameStrategy = context.getManagementNameStrategy(); managementNameStrategy.setNamePattern("CustomName-#name#"); // Add a simple test route context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .routeId("first-route") .log(LoggingLevel.INFO, "First Route", "${body}") .to("mock:result"); from("direct:startOther") .routeId("other-route") .log(LoggingLevel.INFO, "Other Route", "${body}") .to("mock:resultOther"); } }); }
Example #3
Source File: JmxConfigureCamelApplication.java From camel-cookbook-examples with Apache License 2.0 | 4 votes |
public static void main(String[] args) throws Exception { final CamelContext context = new DefaultCamelContext(); // Configure JMX settings final ManagementStrategy managementStrategy = context.getManagementStrategy(); /* managementStrategy.setStatisticsLevel(ManagementStatisticsLevel.All); managementStrategy.setLoadStatisticsEnabled(true); */ // TODO: double check this is right way to get and configure Management Agent final ManagementAgent managementAgent = managementStrategy.getManagementAgent(); managementAgent.setConnectorPort(1099); managementAgent.setServiceUrlPath("/jmxrmi/camel"); managementAgent.setCreateConnector(false); managementAgent.setUsePlatformMBeanServer(true); // TODO: check that level Extended is same/better as ALL managementAgent.setStatisticsLevel(ManagementStatisticsLevel.Extended); managementAgent.setLoadStatisticsEnabled(true); // Add a simple test route context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .log("${body}") .to("mock:result"); } }); // Start the context context.start(); // Send a couple of messages to get some route statistics final ProducerTemplate template = context.createProducerTemplate(); template.sendBody("direct:start", "Hello Camel"); template.sendBody("direct:start", "Camel Rocks!"); // let the Camel runtime do its job for a while Thread.sleep(60000); // shutdown context.stop(); }