Negation is not detected in simple expression - apache-camel

I have simple question. I have a simple expression used in a when-condition:
<simple>${body} !contains '"foo' || ${body} !contains '"bar"' </simple>
Due to unknown reason, I get a syntax error exception when starting the bundle on OSGi (unexpected token:!) But as I can read from the documentation, !contains is valid part of the simple expression language of Camel.
Does anybody now my mistake?

Take care! Since Camel 3 the documentation is splitted for 2.x and 3.x. Notice the small dropdown with default setting latest in the top right corner. You can change it to 2.x
I guess you are running Camel 2.x and if you have a look at the Camel Simple 2.x docs for this version, it is not contains.
In contrast to the !contains of Camel Simple 3.x you found in the latest docs.

Related

JCachePolicy in Camel 2

I want to implement some content-caching on my Camel 2.23.2 routes. While researching I came across Camel's JCache component which, according to the documentation, should have a JCachePolicy that would:
"The JCachePolicy is an interceptor around a route that caches the "result of the route" - the message body - after the route is completed. If next time the route is called with a "similar" Exchange, the cached value is used on the Exchange instead of executing the route."
Which is basically exactly what I'm looking for. However, as it turns out this policy is only available in Camel 3.x and higher.
So my question is, how might I recreate this functionality in Camel 2.23.2?
The solution was quite simple. In the Camel 3.x branch the policy package is available and in it are only two files. The actual policy and the processor.
As it turns out, pending more testing, these files work very well with little adjustment.
On the policy you need to change the method definition for the "wrap" and "beforeWrap" methods. These require the routeContext, not the Route. But moving from the RouteContext to the route is simple enough.
On the processor, the main change is using the correct package for "DelegateAsyncProcessor" it extends.
With those changes everything seemingly works as documented. I used the ehcache spring boot starter in my pom without any further change to have it work with ehcache as it's cachemanager.
One other remark, when you want to use this, the model you want to cache needs to be serializable.

What is the CamelContext in apache?

I searched in web but did not find any explanation that what is the exactly CamelContext? where and how to use ?
I gone through below links also but not satisfied with explanation.
https://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html
https://dzone.com/articles/apache-camel-tutorial-eip
There are many comparision for CamelContext with others, but what I am looking for is the what is it? I want some conceptual explanation.
Please help me to understand this.
It's roughly an instance of a Camel environment, or at least it's a reference to it. Most apps would only have one CamelContext, but you can have several if needed. Looking at the referenced document, it shows how the context has a lifecycle.
In most cases, the context will start and stop along with the application.
After seeing the videos in YouTube, I knew about the Apache camel framework,
and from that I got the answer that camelcontext is nothing but context of the 'apache camel framework' framework.
As many framework have context like Spring have an applicationcontext, Ninja have a context, same the 'Apache camel framework' have a context and that is called 'camelcontext'.
So, it is the run-time system of Apache Camel (framework) and it connects its different concepts such as routes, components or endpoints.
Reference :
Basic Apache Camel Tutorial

Jboss Fuse 6.1.0 upgrade camel feature version

I have been working with Jboss Fuse 6.1.0.redhat-379 for about a month with great results and higher productivity in EIP. Thank you very much to the community for building such a great product.
Now I am getting ready to deploy my bundles in a dev enviroment with several camel routes and even multiple camel contexts in a single bundle and I'm noticing a weird behavior regarding camel contexts JMX display. The bundle with the multiple camel contexts is only showing the first context, others contexts work fine but they are missing in camel JMX display in hawtio.
After research about this behavior I encountered with this JIRA issue https://issues.apache.org/jira/browse/CAMEL-7545 opened by Claus, describing exactly this problem and manifesting that there are Fix Versions (2.12.4, 2.13.2, 2.14.0)
AFAIK my Jboss Fuse version is distributed with camel 2.12.0.redhat-610379 version and there is a mayor 2.14.0.redhat-620031 version that supposedly will fix this issue and it will be bring many other features like json path and sql generated keys.
Is there a way to upgrade versions of camel features in Jboss Fuse?
UPDATE
There is a similar question for this topic (Updating camel version in fuse esb) accepted answer discourages trying to update the version, however, I think it should be better to permit version upgrades if they fix issues
Not a 100% on this but the rollup patches might include the 2.12 fixed versions. Install the latest patch and see if that fixes the issue.

Documentation for migrating from Gatling 1.x to 2.0?

I have been bit by a bug in the JSON parser in Gatling 1.5.5 which I read is solved by migrating to 2.0.
The challenge is, there is very little documentation (that I have been able to find) on Gatling 2, aside from: https://github.com/excilys/gatling/wiki/Gatling%202.
What state is the complete 2.0 documentation in, and is it accessible online yet? If so, can I get a link?
Upcoming Gatling 2 documentation (targeting current snapshot) is now stored in the repository, along with the sources.

ClassCastException+spring

Hi following error I have got please let me know solution
java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor –
Im using tomcat 6.0
This is a known issue. This is the reason:
This was due to efforts from MYFACES-1246, proposal of annotation
processing here in list (adding method), but this of course breaks
compatibility of the same named interfaces.
If you have older code using org.apache.AnnotationProcessor you can make
it work on Tomcat.
Solution is:
Add <Loader delegate="true"/> into context.xml file (to Context element) in tomcat/conf directory.
This makes classloading in Tomcat sticking to J2EE spec.
(I couldn't make it work with suggested approach for only 1 webapp)
This is the reference: http://mail-archives.apache.org/mod_mbox/myfaces-dev/200703.mbox/%3C45F6D22B.1020803#ataco.cz%3E

Resources