Is it possible to change cron expression of camel quartzendpoint at runtime using jmx or so ?
You can update the route itself (including configuration of the quartz endpoint). As an example you can see how Camel plugin of Hawt.io (http://hawt.io/plugins/camel/) does it
No, but you could experiment with CamelContext and see if you can add new routes at runtime.
Related
I use Apache Camel 2.20x.
A camel component can be developed with a uri scheme for example "sample-component". Now the Endpoint of this component can actually extend an existing Endpoint say SQL which has uri syntax as "sql:<select query">.
Now I am listening to camel Exchange event (ExchangeSentEvent) When I retrive the uri from the event I get "sql:<select query">. But what I want is to get "sample-component". How can we achieve that. In simple terms following is the ask
How can we get all Endpoint uri schemes for a camel component.
Thanks in advance
Gk
ComponentName+Endpoint . You can see all the uri that the component will take. All camel components are named this way.There may be exceptions. also if u use intellij idea apache camel plugin it show .
examples
HttpEndpoint
TimerEndpoint
SedaEndpoint
DirectEndpoint
You can also find the consumer and producer classes of these components as follows.
HtppProducer if support HttpConsumer ..
Is there a way to update hystrix configuration at runtime? I am using Java DSL to create route and referring to a hystrix configuration bean in SimpleRegistry (also tried with SpringBean registry). Nothing seems to change when I modify this bean and then do camelContext.addRouteDefinition().
I'm new to Camel and bit confused between CamelContext and Registry.
As far as I know that CamelContext is the base object like ApplicationContext in Spring that is used for add routes and maintains the camel life cycle.
Also we got the Registry object from CamelContext but not sure what is the main purpose of this registry.
My intention is to add the component in the context/registry so that JNDIBind can look up the components.
CamelContext: Kind of Camel Runtime that keeps everything in Camel together, e.g.: Endpoints, TypeConverter, Routes, Components and Registry(!).
Registry: allows you to lookup beans, which by default will be JNDI beans. If you use the spring integration it will be Spring's ApplicationContext.
Generally camel when used with spring makes use of the ApplicationContextRegistry to lookup components, endpoints etc with the name of the bean defined in spring-bean.xml file. In places where we need to use JNDIRegistry we would have to add that registry when creating the CamelContext. This is used in places where JNDI objects are shared accross multiple JVMs where JNDI is the best solution.
Please see different types of registry implementation for camel: camel registries
Can we register Managed Routes,Managed Processors and other ManagedBeans of the camelcontext from the CamlTestSupport class.So that we can see the JMX statistics of the routes and processors of camelTestSupport's camel context.If we can register,how to do it?
Yes override the useJmx method and return true.
https://github.com/apache/camel/blob/master/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java#L440
Then when jmx is enabled then Camel will enlist all those mbeans during testing.
There is a few unit tests we enable jmx when testing with blueprint here, you can take a look at
https://github.com/apache/camel/tree/master/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/management
is it possible to change at runtime the route policy? for instance, if i have the code below
CronScheduledRoutePolicy startPolicy = new CronScheduledRoutePolicy();
startPolicy.setRouteStartTime("* 0 * * * ?");
startPolicy.setRouteStopTime("* 30 * * * ?");
from("direct:foo").routeId("myRoute").routePolicy(startPolicy).autoStartup(false).to("does://not-matter");
I would like to change the cron parameters during the camel execution. In JConsole I can just access to the getRoutePolicyList which returns
CronScheduledRoutePolicy(0x6dc7efb5)
Is it possible in some way access to the startPolicy object and re-instantiate it with a new value? Have I extend the mbean class of camel with some getter and setters?
No not out of the box. But yeah it would be a nice new feature to register the CronScheduledRoutePolicy as a JMX MBean so people can adjust it at runtime with JMX.
I have logged a ticket: https://issues.apache.org/jira/browse/CAMEL-6334
What you can do is to stop the route. And then adjust the startPolicy settings, and then start the route again.
There is JMX operations for starting and stopping routes. What you may need is to expose some JMX operations to adjust the cron policy.
I managed to do this using hawt.io. But for this to work, you need to upgrade to Camel version 2.13.0.
Using hawt.io, you can change cron expressions at runtime in a very user-friendly way.