Apache Camel 2.19 Released - What's New
The latest release of Apache Camel brings improvements to Spring Boot, Java, CamelCatalog, documentation, and much more.
Join the DZone community and get the full member experience.Join For Free
Apache Camel 2.19 was released on May 5th, 2017, and it's about time I do a little blog about what this release includes in terms of noteworthy new features and improvements.
1. Spring Boot Improvements
The Camel 2.19 release has been improved for Spring Boot in numerous ways. For example, all the Camel components now include more details in their Spring Boot metadata files for autoconfiguration. This means tooling can now show default values, documentation, etc. for all the options on each component, language, and data format you may use, and configure in application.properties or .yml files. The release is also up to date with latest Spring Boot 1.5.3 release.
Some components have improved autoconfiguration, which makes it even easier to use, such as camel-servlet where you can easily setup the context-path from the application.properties file. We have made available to configure many more options on CamelContext as well, so you can tweak JMX, stream caching, and many other options.
2. CamelCatalog Improvements
The Camel Catalog now includes fine-grained details of every artifact shipped in the release, and for the other kinds such as camel-hystrix, camel-cdi, etc. The catalog now also includes all the documentation in ASCII doc and HTML format. The catalog has specialized providers for Spring Boot and Karaf runtimes, which allows tooling to know which of the Camel artifacts you can use on those runtimes.
The Camel project uses the catalog itself, so we now use this to automatically generate and keep a full list of all the artifacts on the website, and when each artifact was added. Therefore, you can see whether it's a new artifact in this release, or was introduced in Camel 2.17.
There is a specialized runtime version of the CamelCatalog provided in camel-core RuntimeCamelCatalog, which allows you to tap into the catalog when running Camel. The offline catalog is camel-catalog, which is totally standalone.
3. Camel Maven Plugin Improvements
There is a new validate goal on the camel-maven-plugin that allows you to check your source code and validate all your Camel endpoints and simple expressions, whether they have any invalid configuration or options. I have previously blogged about this.
4. Auto Reload XML Files
If you develop Camel routes in XML files, then you can now turn on auto reload, so Camel will watch the XML files for changes and then automatically update the routes on the fly. I have previously blogged and recorded a video of this.
5. Service Call EIP Improvements
Luca has been busy improving the Service Call EIP so it works better and easier with Camel on the cloud, such as Kubernetes or spring-boot-cloud. Luca blogged recently about this.
6. Calling REST Services is Easier
If you want to use Camel to call RESTful services, it's now easier as we add a producer side to the Rest DSL. This means you can call REST services using the REST component that can then plugin and use any of the HTTP based components in Camel such as restlet, http4, and undertow.
We also added a new camel-swagger-rest component that makes it even easier to call Swagger REST APIs, where you can refer to their operation id, and then let Camel automatically map to its API.
7. CDI With JEE Transactions
The camel-cdi component now supports JEE transactions so you can leverage that out of the box without having to rely on spring transactions anymore.
8. Example Documentation Improved
We now generate a table with all the examples sorted by category. This allows users to find the beginner examples, rest, cloud, etc., and also ensure that we keep better documentation for our examples in the future as the generator tool will WARN if we have examples without documentation. Also, all examples have a readme file with information about the example and how to run.
9. Spring Cloud Components
There are new Camel components that integrate with Spring Cloud and Spring Cloud Netflix. This makes it easy to use for example the ServiceCall EIP or Hystrix EIP with Spring Cloud Netflix or just Camel with Spring Cloud in general. You can find more information in the example.
10. Kafka Improvements
The camel-kafka component has been improved to work more intuitively. This unfortunately means that the URI syntax has changed in a backwards-incompatible way. So, if you are upgrading, make sure to change your URIs. However, the new syntax resembles how other messaging components do it by using kafka:topicName?options.
Also, the component can now automatic convert to the Kafka serializer and deserializer out of the box, so you don't have that hassle. We provide converts to the typically used such as byte and string types.
The component also has been upgraded to the latest Kafka release and it's now possible to store the offset state offline so you can resume from this offset in case you stop and later start your application.
It's also much easier to configure and use custom key and partition key which can be supplied as header values, and there is a new Kafka idempotent repository.
11. Route Contracts
We have added initial support for being able to specify an incoming and outgoing type to a Camel route (called transformer and validator inside Camel). This then allows both Camel at runtime and Camel developers to know what payload the route is expected as input and what it returns. For example, you can specify that a route takes in XML and returns JSON. With XML, you can even specify the namespace. Likewise, you can specify Java types for POJO classes. Based on these contracts, Camel is able at runtime to automatically be able to type-covert the message payload (if possible) between these types if needed.
We will continue with more improvements in this area. For example, we hope we can add such capabilities to Camel components so they will be able to provide such information so your Camel routes are more type-safe with the message payloads during routing. Tooling will also be able to tap into this formation and then for example “flag” users with hints about routes not being compatible etc. You can find more details in this example (we have them for CDI and XML as well) and in the documentation.
12. Reactive Camel
There is a new camel-reactive-streams component that makes Camel work as first-class with the reactive-streams API, so you can easily use Camel components in your reactive flows, or call flows from your Camel routes. For the next release, there is a camel-rx2 component in the works which has improved support for Camel with the popular RxJava 2 framework.
For users that want to use reactive with vert.x, then there is a camel-vertx and vertx-camel-bridge components in both projects. We plan to merge them together and bring the best features from each of them together in the future. Claus is in talks with the vert.x team about this.
13. Java 8 DSL Improvements
The Java 8 DSL has been slightly improved to allow using more of the Java 8 lambda and functional style in your Camel routes and EIPs. We will continue to improve this from time to time when we find EIPs that can be made more awesome for savvy Java 8 users. We are also looking for feedback in this area, so if you are knee deep in the Java 8 style, then help us identify where we can improve the DSL.
14. Camel Connector
We have introduced a new concept called Camel Connector. However, it is still in the early stages and we will, over the next couple of releases, further improve and refine what a Camel connector is. The short story is that a Camel Connector is a specialized and pre-configured Camel Component that can do one thing and one thing only. For example, if you need to know when someone mentions you on Twitter, then you can use the camel-twitter component. But, it can do ten things and it can take time to understand how to use the component and make it work. So instead, you can build a connector that can just do that, a camel-twitter-mention connector. It’s pre-built and configured to just do that, so all you need to do is to configure your Twitter credentials, and off you go. At runtime, the connector is a Camel component, so from a Camel point of view, they are all components, and therefore it runs as first-class in Camel. We have provided some connector examples in the source code.
15. Many More Components
As usual, there are a bunch of new components in every Camel release and this time we have about twenty new components. You can find the list of new components in the release notes, or on the Camel components website where you can search by the 2.19 release number.
There is a bunch of other smaller improvements, which you can find in the release notes. For example, the jsonpath language now allows to use embedded simple language, and you can define predicates in a much simpler syntax without too many of the confusing jsonpath tokens, in case you just want to say order.customer.id > 1000, etc.
Opinions expressed by DZone contributors are their own.