How to consume messages from Apache Camel JMS as Transacted Batch? - apache-camel

I know there is component sjms-batch which could perfectly solve my problem, but that component exist in Camel 3.7, and i need to use Camel 3.8. According to Camel documentation this component doesn't exist anymore after version 3.7. I couldn't find what is the reason for removing this component.
Does someone know why sjms-batch doesn't exist in newer versions?
And is there something similar that i could use with Camel 3.8?

Related

Can I use AtlasMap with an older version of Apache Camel

Our pom.xml shows camel-parent is set at version 2.24.0, and AtlasMap says since Camel 3.7. We will not be updating our Camel version anytime soon, that is an entirely different conversation (government project with no budget for that).
I'm pretty new to Camel - can I just add AtlasMap to the pom.xml and use it anyway? If yes, any advice like special steps, etc?
It is possible to use AtlasMap with Camel 2.x: see https://docs.atlasmap.io/#running-with-apache-camel-2-x
Main differences are:
use atlas instead of atlasmap as component schemein Camel URIs
use io.atlasmap:camel-atlasmap as dependencies
Note that it was not a component provided by the Apache Camel projects in 2.x.

Does groupExchanges() method still exist in apache Camel as part of the AggregationDefinition?

Is there a replacement for the groupExchanges() method;
which, according to the latest documentation, should be possible however, I am unable to compile the code as the method seems to have vanished.
This method is deprecated since Apache Camel 2.15.x and removed since 2.18.x. You are supposed to use GroupedExchangeAggregationStrategy instead.
.aggregate(new GroupedExchangeAggregationStrategy()) // Or AggregationStrategies.groupedExchange()
I have fixed documentation, on the website it will be deployed soon.

Is there a KairosDB component for Apache Camel?

I can't find a Camel component for KairosDB. Is there none?
Should I write a custom component or is there a smarter way?
Thanks
There is no official component for that. You can find the list of components at: https://github.com/apache/camel/tree/master/components#components
Yes you would need to write your own component, or just use regular Java code in a Java bean to integrate with KairosDB and then Camel can integrate with your Java bean. Or use a Camel Processor instead of a Java bean.
But writing a component is not so hard, and if you use KairosDB in more projects with Camel then it starts to make sense to build a Camel component for it. The Apache Camel project loves contributions: http://camel.apache.org/contributing

Validate Camel route programmatically

I'm working on a logging solution where Camel routes are defined at runtime with a Java DSL String. I wonder if there's a way to check programmatically some errors such as components not found in the route. The only option I was able to find is catching the org.apache.camel.ResolveEndpointFailedException and dig into the error message. Is there a better way to validate the route?
Just to give an example, it would be good to ascertain if a route syntax is completely wrong or if just a component wasn't found so that I can output a message e.g. "install ftp component".
You can use Fabric8 Camel Maven Plugin (http://fabric8.io/guide/camelMavenPlugin.html) for validating Camel endpoints in the source code.
Look at this article by Claus Ibsen to get more information : https://blog.fabric8.io/cheers-fabric8-camel-maven-plugin-to-validate-camel-endpoints-from-source-code-8768aff76b41#.wcji8hfdg

Apache camel route deployment - Independently?

Suppose I have 10 different Camel routes in my application, is it possible to stop one particular route alone during an issue and make changes to it(in one of the java processors) and deploy it again without affecting other routes.
Also can I create and deploy a new route on the fly, while other routes are already functioning.
If these are not the default behaviour, what are the options available to achieve this?
Karaf (so do Apache ServiceMix / JBoss Fuse)has hot deployment (nowadays this might be supported in JBoss AS / WildFly as well ). Meaning, you can create your routes as independent blueprint xml files in the deploy folder (meaning just xmls). Likewise you can have xml files for every route, whenever you make changes to XML's, it will be redeployed automatically.
This approach has few drawbacks, it will be complex if you have to deal with JPA or if your route has to deal with custom processors / classes.
Check out the examples in Apache ServiceMix / JBoss Fuse project.
I would recommend this approach especially if you want to take a microcontainer approach - Something like light weight Apache Karaf + Camel Route XML files + Docker.
I have done this few years back, may be this feature is possible to achieve in any other containers as well, which I am not sure.
You can stop a route via org.apache.camel.CamelContext.stopRoute(id) & you can modify it by building a new route and adding it to the context. This would let you change the logic of a route at runtime.
This wouldn't automatically let you hot deploy a new Java processor. I think this aspect of your question isn't Camel specific - their seem to be a few options for this, including OSGi/Karaf mentioned by #gnanaguru.
Perhaps moving the logic that you think might change from a Java processor to somewhere more dynamic (like some JavaScript in an external file, or in the route itself) would be a simpler solution to your problem.

Resources